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 dto(Owner $entity)
 {
     $dto = new OwnerDTO();
     $dto->setId($entity->getId());
     $dto->setEmail($entity->getEmail());
     //		$dto->setPassword($entity->getPassword());
     return $dto;
 }
示例#3
0
 public function testEmailAndPasswordsChanging()
 {
     $dto = new OwnerDTO();
     $dto->setEmail(self::EMAIL);
     $dto->setPassword(self::PASSWORD);
     $this->service->create($dto);
     $status = $this->service->auth(self::EMAIL, self::PASSWORD);
     $this->assertEquals(true, $status);
     $this->service->changePassword(self::ID, self::PASSWORD_ANOTHER);
     $status = $this->service->auth(self::EMAIL, self::PASSWORD_ANOTHER);
     $this->assertEquals(true, $status);
     $status = $this->service->auth(self::EMAIL, self::PASSWORD);
     $this->assertEquals(false, $status);
 }