/** * Tests if correct namespace is returned. * * @param string $expectedNamespace * @param string $document * @param bool $testPath * * @dataProvider getTestData */ public function testDocumentDir($expectedNamespace, $document, $testPath = false) { $finder = new DocumentFinder($this->getBundles()); $this->assertEquals($expectedNamespace, $finder->getNamespace($document)); if ($testPath) { $this->assertGreaterThan(0, count($finder->getBundleDocumentPaths('AcmeBarBundle'))); } }
/** * Retrieves document mapping by namespace. * * @param string $namespace Document namespace. * * @return array|null */ public function getMappingByNamespace($namespace) { if (isset($this->mappings[$namespace])) { return $this->mappings[$namespace]; } $mapping = $this->getDocumentReflectionMapping(new \ReflectionClass($this->finder->getNamespace($namespace))); $this->cacheBundle($namespace, $mapping); return $mapping; }
/** * Returns fully qualified class name. * * @param string $className * * @return string */ public function getClassName($className) { return $this->finder->getNamespace($className); }
/** * Tests for getNamespace(). * * @param string $expectedNamespace * @param string $className * * @dataProvider getTestGetNamespaceData() */ public function testGetNamespace($expectedNamespace, $className) { $bundles = ['AcmeBarBundle' => 'ONGR\\ElasticsearchBundle\\Tests\\app\\fixture\\Acme\\BarBundle\\AcmeBarBundle']; $finder = new DocumentFinder($bundles); $this->assertEquals($expectedNamespace, $finder->getNamespace($className)); }
/** * Retrieves document mapping by namespace. * * @param string $namespace Document namespace. * * @return array|null */ public function getMappingByNamespace($namespace) { return $this->getDocumentReflectionMapping(new \ReflectionClass($this->finder->getNamespace($namespace))); }