/** * Test if delete info returns right isAllowed, when there is a superaccount. */ public function testGetDeletInfoByIdWithSuperAccount() { // changing test data: adding child accounts for ($i = 0; $i < 5; ++$i) { $childAccount = new Account(); $childAccount->setName('child num#' . $i); $childAccount->setParent($this->account); $this->em->persist($childAccount); } $this->em->flush(); $client = $this->createAuthenticatedClient(); $client->request('GET', '/api/accounts/' . $this->account->getId() . '/deleteinfo'); $this->assertEquals('200', $client->getResponse()->getStatusCode()); $response = json_decode($client->getResponse()->getContent()); // deletion not allowed if children existent $this->assertGreaterThan(0, $response->numChildren); // number of returned contacts has to be less or equal 3 $this->assertLessThanOrEqual(3, count($response->children)); }