Example #1
0
 public function testIsMapped()
 {
     // Should return true if type is a FQDN
     $definition = new Src\Definition(array('attribute' => 'attribute', 'key' => 'key', 'accessor' => 'accessor', 'mutator' => 'mutator', 'type' => 'User\\Namespace\\Object'));
     $this->assert->boolean($definition->isMapped())->isTrue();
     // Should return true if type is array and mappedClass is FQDN
     $definition = new Src\Definition(array('attribute' => 'attribute', 'key' => 'key', 'accessor' => 'accessor', 'mutator' => 'mutator', 'type' => 'array', 'mappedClass' => 'User\\Namespace\\Object'));
     $this->assert->boolean($definition->isMapped())->isTrue();
     // Should return false if type is supported and non mappable
     $definition = new Src\Definition(array('attribute' => 'attribute', 'key' => 'key', 'accessor' => 'accessor', 'mutator' => 'mutator', 'type' => 'string'));
     $this->assert->boolean($definition->isMapped())->isFalse();
     // Should return false if type is array and no mappedClass is provided
     $definition = new Src\Definition(array('attribute' => 'attribute', 'key' => 'key', 'accessor' => 'accessor', 'mutator' => 'mutator', 'type' => 'array'));
     $this->assert->boolean($definition->isMapped())->isFalse();
 }