Esempio n. 1
0
 public function testValidateResponseInvalid()
 {
     $clientCommand = new ClientCommand($this->getMock('\\Desk\\Client'), $this->getMock('\\DeskModule\\Transaction\\Transaction'), $this->getMock('\\DeskModule\\Model\\Transaction\\Marshaller\\Guzzle\\Http\\Message\\RequestInterfaceToTransaction'));
     $clientCommand->setCommand(new EmbeddedCommand());
     $preExecute = new PreExecute($clientCommand);
     $response = new Model();
     $response->set('id', 0);
     $postExecute = new PostExecute($preExecute, $response);
     $this->assertFalse($postExecute->propagationIsStopped());
     $actual = $this->sut->validateResponse($postExecute);
     $this->assertTrue($postExecute->propagationIsStopped());
     $this->assertFalse($actual);
 }
Esempio n. 2
0
 public function testDeprecateAllCompanies()
 {
     /** @var Company|\PHPUnit_Framework_MockObject_MockObject $clientService */
     $clientService = $this->getMock('DeskModule\\Client\\Company\\Company');
     $companyListPage = $this->getMock('\\Desk\\Relationship\\Resource\\Model');
     $clientService->expects($this->once())->method('getList')->will($this->returnValue($companyListPage));
     $deprecatedDeskCompany = new Model();
     $deprecatedDeskCompany->set('custom_fields', array('deprecated' => true));
     $deskCompany = new Model();
     $deskCompany->set('custom_fields', array('deprecated' => null));
     $companyListPage->expects($this->once())->method('getEmbedded')->with('entries')->will($this->returnValue(array($deprecatedDeskCompany, $deskCompany)));
     $eventManager = $this->getMock('DeskModule\\Client\\Company\\Event\\Manager');
     $this->sut->setCompanyClientService($clientService);
     $this->sut->setCompanyClientEventManager($eventManager);
     $this->sut->setLogger($this->getMock('\\Logger', array(), array(), '', false));
     $response = $this->sut->deprecateAllCompanies();
     $this->assertTrue($response);
 }