[ 'directory' => [ 'schema.xml' => 'Schema from configuration' ] ], ]; $this->root = vfsStream::setup('projectDir'); vfsStream::create($pathStructure); $this->kernelMock = $this->getMockBuilder(Kernel::class)->disableOriginalConstructor()-> getMock(); $this->kernelMock->method('getProjectDir')->willReturn($this->root->url()); $this->bundleMock = new FakeBundle(); $this->configuration['paths']['schemaDir'] = vfsStream::url('projectDir/configuration/directory'); $this->fileLocator = new FileLocator( [ __DIR__ . '/../Fixtures', ] ); } public function testLocateFromBundle() { $locator = new SchemaLocator($this->fileLocator, $this->configuration); $files = $locator->locateFromBundle($this->bundleMock); $this->assertCount(1, $files); $this->assertTrue(isset($files[__DIR__ . '/../Fixtures/FakeBundle/Resources/config/bundle.schema.xml'])); $this->assertEquals('bundle.schema.xml', $files[__DIR__ . '/../Fixtures/FakeBundle/Resources/config/bundle.schema.xml'][1]->getFileName()); } public function testLocateFromBundlesAndConfiguration() { $locator = new SchemaLocator($this->fileLocator, $this->configuration); $files = $locator->locateFromBundlesAndConfiguration( [$this->bundleMock] ); $this->assertCount(2, $files); $this->assertTrue(isset($files[__DIR__ . '/../Fixtures/FakeBundle/Resources/config/bundle.schema.xml'])); $this->assertEquals('bundle.schema.xml', $files[__DIR__ . '/../Fixtures/FakeBundle/Resources/config/bundle.schema.xml'][1]->getFileName()); $this->assertTrue(isset($files['vfs://projectDir/configuration/directory/schema.xml'])); $this->assertEquals('schema.xml', $files['vfs://projectDir/configuration/directory/schema.xml'][1]->getFileName()); } }