* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ abstract class ListingTestCase extends TestCase { public function testGetAvailableRoutes() { $listing = $this->newListing(); $routes = $listing->getAvailableRoutes(); $this->assertIsArray($routes); $this->assertEquals(2, count($routes)); $this->assertInstanceOf(Route::class, $routes[0]); $this->assertEquals('/foo', $routes[0]->getPath()); $this->assertEquals('/bar', $routes[1]->getPath()); $routes = $listing->getAvailableRoutes(); $this->assertIsArray($routes); $this->assertEquals(2, count($routes)); $this->assertInstanceOf(Route::class, $routes[0]); $this->assertEquals('/foo', $routes[0]->getPath()); $this->assertEquals('/bar', $routes[1]->getPath()); } public function testGetAvailableRoutesFilter() { $listing = $this->newListing(); $routes = $listing->getAvailableRoutes(new RegxpFilter('^/foo')); $this->assertIsArray($routes); $this->assertEquals(1, count($routes)); $this->assertInstanceOf(Route::class, $routes[0]); $this->assertEquals('/foo', $routes[0]->getPath()); $routes = $listing->getAvailableRoutes(new RegxpFilter('^/bar')); $this->assertIsArray($routes); $this->assertEquals(1, count($routes)); $this->assertInstanceOf(Route::class, $routes[0]); $this->assertEquals('/bar', $routes[0]->getPath()); } public function testFind() { $listing = $this->newListing(); $specification = $listing->find('/foo'); $this->assertInstanceOf(SpecificationInterface::class, $specification); $this->assertEquals('/foo', $specification->getResourceCollection()->get('/foo')->getPath()); $specification = $listing->find('/foo'); $this->assertInstanceOf(SpecificationInterface::class, $specification); $this->assertEquals('/foo', $specification->getResourceCollection()->get('/foo')->getPath()); $specification = $listing->find('/bar'); $this->assertInstanceOf(SpecificationInterface::class, $specification); $this->assertEquals('/bar', $specification->getResourceCollection()->get('/bar')->getPath()); } public function testFindAll() { $listing = $this->newListing(); $specification = $listing->findAll(); $this->assertInstanceOf(SpecificationInterface::class, $specification); $this->assertEquals(2, $specification->getResourceCollection()->count()); $this->assertInstanceOf(Resource::class, $specification->getResourceCollection()->get('/foo')); $this->assertInstanceOf(Resource::class, $specification->getResourceCollection()->get('/bar')); $specification = $listing->findAll(); $this->assertInstanceOf(SpecificationInterface::class, $specification); $this->assertEquals(2, $specification->getResourceCollection()->count()); $this->assertInstanceOf(Resource::class, $specification->getResourceCollection()->get('/foo')); $this->assertInstanceOf(Resource::class, $specification->getResourceCollection()->get('/bar')); } public function testFindAllFilter() { $listing = $this->newListing(); $specification = $listing->findAll(null, new RegxpFilter('^/foo')); $this->assertInstanceOf(SpecificationInterface::class, $specification); $this->assertEquals(1, $specification->getResourceCollection()->count()); $this->assertInstanceOf(Resource::class, $specification->getResourceCollection()->get('/foo')); $specification = $listing->findAll(null, new RegxpFilter('^/bar')); $this->assertInstanceOf(SpecificationInterface::class, $specification); $this->assertEquals(1, $specification->getResourceCollection()->count()); $this->assertInstanceOf(Resource::class, $specification->getResourceCollection()->get('/bar')); } /** * @return \PSX\Api\ListingInterface */ abstract protected function newListing(); } __halt_compiler();----SIGNATURE:----LEOSEttOzfGlGux+qHlS57SdVpQ6AAw/1MTpPQxdhC15liGoO/8rUpbZpJ3cf5Mc7HaGqlSvPUTURFCKjtcfi7eeDQEfEho7Z9cHbyovhiNCW5POP0VNsd6y6nXFXSSjw5pVM2jTED9ZtBgfVSijvEvIOswAqPWyByGk/N5iFUKIxAvEgI1fPWYMKIXhQEH6FOiNtEII1P6K8miJin6Zis7hWuEMa2ROXMs7sjLDD7Quc/+EEnJF1p5V+zcd4SywzjtGFdVvSNacgdI+5ibQyEQVNSGbDyjYcpuBPhQ3P224Zp8Kpbcb1wSpJ43MB0NEkOIYXTJ6IqvYeFqCLXQbvZkQzw+AkctOreoHg3pkuYnS2OfGAxoIgugkysx+6Y1Y4cnxwWmbpF70ENBuN615fvLSxtx0zzsZZs3Op3gc/Ev5hGc+V/mPKCetoTu/YCEKFIXuL07nravV69aVmeXN1ncP8r3tB7ZBNHt6tJdEv/qXyYzRgsC9AaXzta6mRr2fBZ4zaX6OtgTpey7q4ISXtzTYD4cOtjhOMA1PwN4vSMReg473aC84GI+B6eVPamdTI859aRKUA+WnZ9xajVykFEOpCkf+vrZCofRP2k6COZEj6SVHfJSwJ2KbiiPgxSBZeEcIQ8Ao8ce4mvHsXQgWKHzqBgxVdg5R03j7rRlSLt8=----ATTACHMENT:----NzUxNjA4OTA0NDYyOTI4NCA0MjQ2MDc3NjkyNTY1NzYyIDU5MTQwOTI4NDkxMDE2MDM=