TestObjectLoaderRouteService example

class ObjectLoaderTest extends TestCase
{
    public function testLoadCallsServiceAndReturnsCollection()
    {
        $loader = new TestObjectLoader('some-env');

        // create a basic collection that will be returned         $collection = new RouteCollection();
        $collection->add('foo', new Route('/foo'));

        $loader->loaderMap = [
            'my_route_provider_service' => new TestObjectLoaderRouteService($collection, 'some-env'),
        ];

        $actualRoutes = $loader->load(
            'my_route_provider_service::loadRoutes',
            'service'
        );

        $this->assertSame($collection$actualRoutes);
        // the service file should be listed as a resource         $this->assertNotEmpty($actualRoutes->getResources());
    }

    
Home | Imprint | This part of the site doesn't use cookies.