public function testGetByDeskId() { $deskId = $this->getId(); $map = new CompanyMapModel(); $map->setDeskId($deskId); /** @var PHPUnit_Framework_MockObject_MockObject $mockRepository */ $mockRepository = $this->sut->getRepository(); $mockRepository->expects($this->once())->method('findOneBy')->with(array('deskId' => $deskId))->will($this->returnValue($map)); /** @var Repository $mockRepository */ $this->sut->setRepository($mockRepository); $actual = $this->sut->getByDeskId($deskId); $this->assertSame($map, $actual); }
public function testDeprecateReturnsFalseIfNoDeskModelExists() { $mapModel = self::$mapModel->setDeskId(1); $deskModel = new Model(); /** @var Company|PHPUnit_Framework_MockObject_MockObject $sut */ $sut = $this->getMock('DeskModule\\Company\\Company', array('getMapByCompany', 'getCompanyClientService')); $sut->expects($this->once())->method('getMapByCompany')->with(self::$companyModel)->willReturn($mapModel); $clientServiceMock = $this->getMock('DeskModule\\Client\\Company\\Company'); $clientServiceMock->expects($this->once())->method('getByDeskId')->with($mapModel->getDeskId()); $sut->expects($this->once())->method('getCompanyClientService')->willReturn($clientServiceMock); $result = $sut->deprecate(self::$companyModel); $this->assertFalse($result); }