PartKeepr\ProjectBundle\Tests\ProjectTest::testProjectPartRemoval PHP Method

testProjectPartRemoval() public method

    public function testProjectPartRemoval()
    {
        $client = static::makeClient(true);
        $project = $this->fixtures->getReference('project');
        $projectPart = $this->fixtures->getReference('projectpart.1');
        $project->removePart($projectPart);
        $serializedProject = $this->getContainer()->get('serializer')->normalize($project, 'jsonld');
        $iriConverter = $this->getContainer()->get('api.iri_converter');
        $iri = $iriConverter->getIriFromItem($project);
        $client->request('PUT', $iri, [], [], [], json_encode($serializedProject));
        $response = json_decode($client->getResponse()->getContent());
        $this->assertInternalType('array', $response->parts);
        $this->assertArrayNotHasKey(1, $response->parts, 'When removing an entry from the ArrayCollection, the array must be resorted!');
        $this->assertEquals(1, count($response->parts));
    }