/**
  * Return the "real" class name if the given class name is a proxy
  * class name.
  *
  * @param string $className
  *
  * @return string
  */
 public static function getUserClassName($className)
 {
     if (null === self::$inflector) {
         static::$inflector = new ProxyManagerClassNameInflector('');
     }
     return static::$inflector->getUserClassName($className);
 }
 /**
  * @covers \ProxyManager\Inflector\ClassNameInflector::getProxyClassName
  *
  * @dataProvider getClassAndParametersCombinations
  *
  * @param string $className
  * @param array  $parameters
  */
 public function testClassNameIsValidClassIdentifier($className, array $parameters)
 {
     $inflector = new ClassNameInflector('ProxyNS');
     $this->assertRegExp('/([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]+)(\\\\[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]+)*/', $inflector->getProxyClassName($className, $parameters), 'Class name string is a valid class identifier');
 }
Exemplo n.º 3
0
 /**
  * @covers \ProxyManager\Inflector\ClassNameInflector::getProxyClassName
  */
 public function testGeneratesCorrectClassNameWhenGivenLeadingBackslash()
 {
     $inflector = new ClassNameInflector('ProxyNS');
     $this->assertSame($inflector->getProxyClassName('\\Foo\\Bar', array('tab' => 'baz')), $inflector->getProxyClassName('Foo\\Bar', array('tab' => 'baz')));
 }