Skip to content

Commit

Permalink
Expose only non static attributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Dec 2, 2017
1 parent 1d12f3b commit a1db586
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
2 changes: 0 additions & 2 deletions src/Database/Type.php
Expand Up @@ -313,8 +313,6 @@ public function __debugInfo()
{
return [
'name' => $this->_name,
'types' => static::$_types,
'builtTypes' => static::$_builtTypes,
];
}
}
35 changes: 18 additions & 17 deletions tests/TestCase/Database/TypeTest.php
Expand Up @@ -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
*
Expand All @@ -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'));
}

/**
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit a1db586

Please sign in to comment.