コード例 #1
0
 public function testCRUD()
 {
     $dto = new OwnerDTO();
     $dto->setEmail(self::EMAIL);
     $dto->setPassword(self::PASSWORD);
     $json = json_encode($dto);
     $this->curl->doPost($json);
     $data = $this->curl->getResultData();
     $this->assertEquals(self::ID, $data->id);
     $this->assertEquals(self::EMAIL, $data->email);
     $this->assertNull($data->password);
     $this->curl->doGetId(self::ID);
     $data = $this->curl->getResultData();
     $this->assertEquals(self::ID, $data->id);
     $this->assertEquals(self::EMAIL, $data->email);
     $this->assertNull($data->password);
     $dto->setId(self::ID);
     $dto->setEmail(self::EMAIL_ANOTHER);
     $json = json_encode($dto);
     $this->curl->doPut(self::ID, $json);
     $data = $this->curl->getResultData();
     $this->assertEquals(self::ID, $data->id);
     $this->assertEquals(self::EMAIL_ANOTHER, $data->email);
     $this->assertNull($data->password);
     $this->curl->doDelete(self::ID);
     $this->curl->doGetId(self::ID);
     $data = $this->curl->getResultData();
     $this->assertNull($data->id);
     $this->assertNull($data->email);
     $this->assertNull($data->password);
 }
コード例 #2
0
 public function testDelete()
 {
     $this->curl->doDelete(self::ID);
     $result = $this->curl->getResult();
     $this->assertEquals('Controller\\TestController::delete', $result->message->method);
     $this->assertNull($result->data);
     $this->assertEquals('DELETE', $result->message->server->REQUEST_METHOD);
 }
コード例 #3
0
ファイル: RouterTest.php プロジェクト: asanoturna/finance-2
 public function testConnection()
 {
     $this->curl->doGet();
     $result = $this->curl->getResult();
     $info = $this->curl->getInfo();
     $this->assertEquals('application/json', $info['content_type']);
     $this->assertEquals(400, $info['http_code']);
     $this->assertEquals(false, $result->success);
     $this->assertEquals(400, $result->statusCode);
     $this->assertEquals(Application::ERROR_WS_NOT_FOUND, $result->message);
 }