Browse Source

Expose only non static attributes.

dereuromark 8 years ago
parent
commit
a1db5868c1
2 changed files with 18 additions and 19 deletions
  1. 0 2
      src/Database/Type.php
  2. 18 17
      tests/TestCase/Database/TypeTest.php

+ 0 - 2
src/Database/Type.php

@@ -313,8 +313,6 @@ class Type implements TypeInterface
     {
         return [
             'name' => $this->_name,
-            'types' => static::$_types,
-            'builtTypes' => static::$_builtTypes,
         ];
     }
 }

+ 18 - 17
tests/TestCase/Database/TypeTest.php

@@ -163,6 +163,23 @@ class TypeTest extends TestCase
     }
 
     /**
+     * Tests new types can be registered and built as objects
+     *
+     * @return void
+     */
+    public function testMapAndBuildWithObjects()
+    {
+        $map = Type::map();
+        Type::clear();
+
+        $uuidType = new UuidType('uuid');
+        Type::map('uuid', $uuidType);
+
+        $this->assertSame($uuidType, Type::build('uuid'));
+        Type::map($map);
+    }
+
+    /**
      * Tests clear function in conjunction with map
      *
      * @return void
@@ -181,7 +198,7 @@ class TypeTest extends TestCase
 
         $this->assertEquals(array_keys($map), array_keys($newMap));
         $this->assertEquals($map['integer'], $newMap['integer']);
-        $this->assertSame($type, Type::build('float'));
+        $this->assertEquals($type, Type::build('float'));
     }
 
     /**
@@ -263,25 +280,9 @@ class TypeTest extends TestCase
     public function testDebugInfo()
     {
         $type = new Type('foo');
-        Type::clear();
-        Type::map('bool', BoolType::class);
-        Type::map('int', IntegerType::class);
-        $uuidType = new UuidType('uuid');
-        Type::map('uuid', $uuidType);
-        Type::build('bool');
-
         $result = $type->__debugInfo();
-        $boolType = new BoolType('bool');
         $expected = [
             'name' => 'foo',
-            'types' => [
-                'bool' => $boolType,
-                'int' => IntegerType::class,
-                'uuid' => $uuidType,
-            ],
-            'builtTypes' => [
-                'bool' => $boolType,
-            ],
         ];
         $this->assertEquals($expected, $result);
     }