Example #1
0
 public function testIsUserMapped()
 {
     // Should return true if type is a custom user FQDN
     $definition = new Src\Definition(array('attribute' => 'attribute', 'key' => 'key', 'accessor' => 'accessor', 'mutator' => 'mutator', 'type' => 'User\\Namespace\\Object'));
     $this->assert->boolean($definition->isUserMapped())->isTrue();
     // Should return true if type is array and mappedClass is a custom FQDN
     $definition = new Src\Definition(array('attribute' => 'attribute', 'key' => 'key', 'accessor' => 'accessor', 'mutator' => 'mutator', 'type' => 'array', 'mappedClass' => 'User\\Namespace\\Object'));
     $this->assert->boolean($definition->isUserMapped())->isTrue();
     foreach (Src\Definition::$nativeClasses as $nativeClass => $boolean) {
         // Should return false if type is a native supported FQDN
         $definition = new Src\Definition(array('attribute' => 'attribute', 'key' => 'key', 'accessor' => 'accessor', 'mutator' => 'mutator', 'type' => $nativeClass));
         $this->assert->boolean($definition->isUserMapped())->isFalse();
         // Should return false if type is array and mappedClass a native supported FQDN
         $definition = new Src\Definition(array('attribute' => 'attribute', 'key' => 'key', 'accessor' => 'accessor', 'mutator' => 'mutator', 'type' => 'array', 'mappedClass' => $nativeClass));
         $this->assert->boolean($definition->isUserMapped())->isFalse();
     }
     // Should return false if type isn't a FQDN
     $definition = new Src\Definition(array('attribute' => 'attribute', 'key' => 'key', 'accessor' => 'accessor', 'mutator' => 'mutator', 'type' => 'string'));
     $this->assert->boolean($definition->isUserMapped())->isFalse();
 }