Ejemplo n.º 1
0
 public function testCommonNamespace()
 {
     $provider = new ClassNameProvider('Grace\\Tests\\ORM\\Plug');
     $this->assertEquals('TaxiPassenger', $provider->getBaseClass('TaxiPassenger'));
     $this->assertEquals('TaxiPassenger', $provider->getBaseClass('\\Grace\\Tests\\ORM\\Plug\\Model\\TaxiPassenger'));
     $this->assertEquals('TaxiPassenger', $provider->getBaseClass('Grace\\Tests\\ORM\\Plug\\Model\\TaxiPassenger'));
     $this->assertEquals('TaxiPassenger', $provider->getBaseClass('\\Grace\\Tests\\ORM\\Plug\\Finder\\TaxiPassengerFinder'));
     $this->assertEquals('TaxiPassenger', $provider->getBaseClass('Grace\\Tests\\ORM\\Plug\\Finder\\TaxiPassengerFinder'));
     $this->assertEquals('\\Grace\\Tests\\ORM\\Plug\\Model\\TaxiPassenger', $provider->getModelClass('TaxiPassenger'));
     $this->assertEquals('\\Grace\\Tests\\ORM\\Plug\\Model\\TaxiPassenger', $provider->getModelClass('\\Grace\\Tests\\ORM\\Plug\\Model\\TaxiPassenger'));
     $this->assertEquals('\\Grace\\Tests\\ORM\\Plug\\Model\\TaxiPassenger', $provider->getModelClass('Grace\\Tests\\ORM\\Plug\\Model\\TaxiPassenger'));
     $this->assertEquals('\\Grace\\Tests\\ORM\\Plug\\Model\\TaxiPassenger', $provider->getModelClass('\\Grace\\Tests\\ORM\\Plug\\Finder\\TaxiPassengerFinder'));
     $this->assertEquals('\\Grace\\Tests\\ORM\\Plug\\Model\\TaxiPassenger', $provider->getModelClass('Grace\\Tests\\ORM\\Plug\\Finder\\TaxiPassengerFinder'));
     $this->assertEquals('\\Grace\\Tests\\ORM\\Plug\\Finder\\TaxiPassengerFinder', $provider->getFinderClass('TaxiPassenger'));
     $this->assertEquals('\\Grace\\Tests\\ORM\\Plug\\Finder\\TaxiPassengerFinder', $provider->getFinderClass('\\Grace\\Tests\\ORM\\Plug\\Model\\TaxiPassenger'));
     $this->assertEquals('\\Grace\\Tests\\ORM\\Plug\\Finder\\TaxiPassengerFinder', $provider->getFinderClass('Grace\\Tests\\ORM\\Plug\\Model\\TaxiPassenger'));
     $this->assertEquals('\\Grace\\Tests\\ORM\\Plug\\Finder\\TaxiPassengerFinder', $provider->getFinderClass('\\Grace\\Tests\\ORM\\Plug\\Finder\\TaxiPassengerFinder'));
     $this->assertEquals('\\Grace\\Tests\\ORM\\Plug\\Finder\\TaxiPassengerFinder', $provider->getFinderClass('Grace\\Tests\\ORM\\Plug\\Finder\\TaxiPassengerFinder'));
 }
Ejemplo n.º 2
0
 protected function generateGraceClassPhpdoc()
 {
     $phpdoc = array();
     foreach ($this->modelsConfig->models as $name => $config) {
         $this->lastProcessedElement = $name;
         // example:
         //  * @property \Grace\Bundle\Finder\TaxiPassengerFinder $taxiPassengerFinder
         $propName = lcfirst($name);
         $phpdoc[] = "@property " . $this->classNameProvider->getFinderClass($name) . " \${$propName}Finder";
     }
     return $phpdoc;
 }