Example #1
0
 public function testIsNativeMapped()
 {
     foreach (Src\Definition::$nativeClasses as $nativeClass => $boolean) {
         // Should return true for each native types embedded as single document
         $definition = new Src\Definition(array('attribute' => 'attribute', 'key' => 'key', 'accessor' => 'accessor', 'mutator' => 'mutator', 'type' => $nativeClass));
         $this->assert->boolean($definition->isNativeMapped())->isTrue();
         // Should return true for each native types embedded as collection of documents
         $definition = new Src\Definition(array('attribute' => 'attribute', 'key' => 'key', 'accessor' => 'accessor', 'mutator' => 'mutator', 'type' => 'array', 'mappedClass' => $nativeClass));
         $this->assert->boolean($definition->isNativeMapped())->isTrue();
     }
     // Should return false if type isn't a FQDN
     $definition = new Src\Definition(array('attribute' => 'attribute', 'key' => 'key', 'accessor' => 'accessor', 'mutator' => 'mutator'));
     $this->assert->boolean($definition->isNativeMapped())->isFalse();
     // Should return false if type is a FQDN and isn't natively supported
     $definition = new Src\Definition(array('attribute' => 'attribute', 'key' => 'key', 'accessor' => 'accessor', 'mutator' => 'mutator', 'type' => 'User\\Namespace\\Object'));
     $this->assert->boolean($definition->isNativeMapped())->isFalse();
     // Should return false for non native FQDN type
     $definition = new Src\Definition(array('attribute' => 'attribute', 'key' => 'key', 'accessor' => 'accessor', 'mutator' => 'mutator', 'type' => 'array', 'mappedClass' => 'User\\Namespace\\Object'));
     $this->assert->boolean($definition->isNativeMapped())->isFalse();
 }