Skip to content
Permalink
Browse files

Expose only non static attributes.

  • Loading branch information...
dereuromark committed Dec 2, 2017
1 parent 1d12f3b commit a1db5868c1e2d4ad8fb0898b8cadf285e0029bbe
Showing with 18 additions and 19 deletions.
  1. +0 −2 src/Database/Type.php
  2. +18 −17 tests/TestCase/Database/TypeTest.php
@@ -313,8 +313,6 @@ public function __debugInfo()
{
return [
'name' => $this->_name,
'types' => static::$_types,
'builtTypes' => static::$_builtTypes,
];
}
}
@@ -162,6 +162,23 @@ public function testReMapAndBuild()
$this->assertInstanceOf($barType, $type);
}
/**
* 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
*
@@ -181,7 +198,7 @@ public function testClear()
$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 @@ public function testSet()
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);
}

0 comments on commit a1db586

Please sign in to comment.
You can’t perform that action at this time.