diff --git a/Mapping/DocumentFinder.php b/Mapping/DocumentFinder.php index 214a1a9f..f5617f17 100644 --- a/Mapping/DocumentFinder.php +++ b/Mapping/DocumentFinder.php @@ -49,7 +49,7 @@ public function getNamespace($namespace) list($bundle, $document) = explode(':', $namespace); $bundle = $this->getBundle($bundle); $namespace = substr($bundle, 0, strrpos($bundle, '\\')) . '\\' . - $this->getDocumentDir() . '\\' . $document; + str_replace('/', '\\', $this->getDocumentDir()) . '\\' . $document; } return $namespace; diff --git a/Tests/Unit/Mapping/DocumentFinderTest.php b/Tests/Unit/Mapping/DocumentFinderTest.php new file mode 100644 index 00000000..2f6a26db --- /dev/null +++ b/Tests/Unit/Mapping/DocumentFinderTest.php @@ -0,0 +1,71 @@ +getBundles()); + $finder->setDocumentDir($documentDir); + + $this->assertEquals($expectedNamespace, $finder->getNamespace('AcmeTestBundle:Product')); + } + + /** + * @return array + */ + public function getBundles() + { + return ['AcmeTestBundle' => 'ONGR\ElasticsearchBundle\Tests\app\fixture\Acme\TestBundle\AcmeTestBundle']; + } +}