/** * Run test for null repository */ public function testNullRepository() { /** @var SearchCriteria|\PHPUnit_Framework_MockObject_MockObject $searchCriteriaMock */ $searchCriteriaMock = $this->getMockBuilder(SearchCriteria::class)->getMockForAbstractClass(); /** @var PaymentTokenInterface|\PHPUnit_Framework_MockObject_MockObject $tokenMock */ $tokenMock = $this->getMockBuilder(PaymentTokenInterface::class)->getMockForAbstractClass(); /** @var PaymentTokenSearchResultsInterface|\PHPUnit_Framework_MockObject_MockObject $searchResultMock */ $searchResultMock = $this->getMockBuilder(PaymentTokenSearchResultsInterface::class)->getMockForAbstractClass(); $this->objectManagerMock->expects(self::never())->method('get'); $proxy = new PaymentTokenRepositoryProxy($this->nullRepositoryMock, $this->vaultPaymentMock, $this->configMock, $this->objectManagerMock, []); $this->nullRepositoryMock->expects(self::once())->method('getById')->with(1)->willReturn($tokenMock); $this->nullRepositoryMock->expects(self::once())->method('getList')->with($searchCriteriaMock)->willReturn($searchResultMock); self::assertEquals($tokenMock, $proxy->getById(1)); self::assertEquals($searchResultMock, $proxy->getList($searchCriteriaMock)); }
/** * @expectedException \LogicException * @expectedExceptionMessageRegExp You must implement this operation\. \([^:]+::delete\) */ public function testNullRepositoryExceptionDelete() { /** @var PaymentTokenInterface|\PHPUnit_Framework_MockObject_MockObject $tokenMock */ $tokenMock = $this->getMockBuilder(PaymentTokenInterface::class)->getMockForAbstractClass(); $this->repository->delete($tokenMock); }