/** * Returns a persistence Handler mock * * @return \eZ\Publish\SPI\Persistence\Handler|\PHPUnit_Framework_MockObject_MockObject */ protected function getPersistenceMock() { if ( !isset( $this->persistenceMock ) ) { $this->persistenceMock = $this->getMock( "eZ\\Publish\\SPI\\Persistence\\Handler", array(), array(), '', false ); $this->persistenceMock->expects( $this->any() ) ->method( 'contentHandler' ) ->will( $this->returnValue( $this->getPersistenceMockHandler( 'Content\\Handler' ) ) ); $this->persistenceMock->expects( $this->any() ) ->method( 'searchHandler' ) ->will( $this->returnValue( $this->getSPIMockHandler( 'Search\\Handler' ) ) ); $this->persistenceMock->expects( $this->any() ) ->method( 'contentTypeHandler' ) ->will( $this->returnValue( $this->getPersistenceMockHandler( 'Content\\Type\\Handler' ) ) ); $this->persistenceMock->expects( $this->any() ) ->method( 'contentLanguageHandler' ) ->will( $this->returnValue( $this->getPersistenceMockHandler( 'Content\\Language\\Handler' ) ) ); $this->persistenceMock->expects( $this->any() ) ->method( 'locationHandler' ) ->will( $this->returnValue( $this->getPersistenceMockHandler( 'Content\\Location\\Handler' ) ) ); $this->persistenceMock->expects( $this->any() ) ->method( 'objectStateHandler' ) ->will( $this->returnValue( $this->getPersistenceMockHandler( 'Content\\ObjectState\\Handler' ) ) ); $this->persistenceMock->expects( $this->any() ) ->method( 'trashHandler' ) ->will( $this->returnValue( $this->getPersistenceMockHandler( 'Content\\Location\\Trash\\Handler' ) ) ); $this->persistenceMock->expects( $this->any() ) ->method( 'userHandler' ) ->will( $this->returnValue( $this->getPersistenceMockHandler( 'User\\Handler' ) ) ); $this->persistenceMock->expects( $this->any() ) ->method( 'sectionHandler' ) ->will( $this->returnValue( $this->getPersistenceMockHandler( 'Content\\Section\\Handler' ) ) ); $this->persistenceMock->expects( $this->any() ) ->method( 'urlAliasHandler' ) ->will( $this->returnValue( $this->getPersistenceMockHandler( 'Content\\UrlAlias\\Handler' ) ) ); $this->persistenceMock->expects( $this->any() ) ->method( 'urlWildcardHandler' ) ->will( $this->returnValue( $this->getPersistenceMockHandler( 'Content\\UrlWildcard\\Handler' ) ) ); } return $this->persistenceMock; }
/** * Test that instance is of correct type * * @covers eZ\Publish\Core\Persistence\Factory::getUrlWildcardHandler * @depends testGetPersistenceHandler */ public function testGetUrlWildcardHandler() { $this->persistenceMock->expects($this->once())->method('urlWildcardHandler'); $this->persistenceFactory->getUrlWildcardHandler(); }