public function testGetValueFromPublicGetter()
 {
     // private getters don't work yet because ReflectionMethod::setAccessible()
     // does not exists yet in a stable PHP release
     $entity = new Entity('foobar');
     $metadata = new GetterMetadata(self::CLASSNAME, 'internal');
     $this->assertEquals('foobar from getter', $metadata->getValue($entity));
 }
 /**
  * Gets Bundle name using entity reference.
  *
  * @param GetterMetadata $getterMetadata
  * @return string Bundle Name
  */
 public function getBundle(GetterMetadata $getterMetadata)
 {
     $all = $this->container->getParameter('kernel.bundles');
     preg_match("/^(.+)\\\\([^\\\\]+Bundle)(\\\\.+?)\$/", $getterMetadata->getClassName(), $m);
     if (!empty($m[2]) && array_key_exists($m[2], $all)) {
         $bundle = $m[2];
     } else {
         $chunks = explode(chr(92), $getterMetadata->getClassName());
         $bundle = $chunks[0] . $chunks[1];
     }
     return $bundle;
 }
 public function testGetPropertyValueFromOverriddenPublicGetter()
 {
     $entity = new Entity();
     $metadata = new GetterMetadata(self::CLASSNAME, 'data');
     $this->assertEquals('Overridden data', $metadata->getPropertyValue($entity));
 }
 public function testGetPropertyValueFromHasser()
 {
     $entity = new Entity();
     $metadata = new GetterMetadata(self::CLASSNAME, 'permissions');
     $this->assertEquals('permissions', $metadata->getPropertyValue($entity));
 }