/** * testing adduser action. */ public function testAddUserAction() { $crawler = $this->client->request('POST', '/secured/user/add/' . $this->user->getId()); $this->assertTrue($this->client->getResponse()->headers->contains('Content-Type', 'application/json')); $crawler = $this->client->request('POST', '/secured/user/add/' . $this->user->getId(), array('user' => array('username' => $this->user->getUsername(), 'email' => $this->user->getEmail(), 'employeeName' => $this->user->getEmployee()->getEmployeeName(), 'taxIdentification' => $this->user->getEmployee()->getTaxIdentification(), 'bankAccountNumber' => $this->user->getEmployee()->getBankAccountNumber(), 'bankName' => $this->user->getEmployee()->getBankName(), 'userId' => $this->user->getId(), 'isActive' => $this->user->getIsActive()))); $decodedJson = json_decode($this->client->getResponse()->getContent(), true); $this->assertJson($this->client->getResponse()->getContent(), 'testAddUserAction: The response\'s content is not a JSON object.'); $this->assertTrue($this->client->getResponse()->headers->contains('Content-Type', 'application/json'), 'testAddUserAction: The content-type is not a json.'); $this->assertArrayHasKey('response', $decodedJson[0], 'testAddUserAction: Missing response array key.'); $this->assertEquals('error', $decodedJson[0]['response'], 'testAddUserAction: Missing array value.'); }