Skip to content

Commit 5afdb09

Browse files
committed
Add object tests for the loose type checker
1 parent 8347a38 commit 5afdb09

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/Constraints/TypeTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace JsonSchema\Tests\Constraints;
1111

1212
use JsonSchema\Constraints\TypeConstraint;
13+
use JsonSchema\Constraints\TypeCheck\LooseTypeCheck;
1314

1415
/**
1516
* Class TypeTest
@@ -49,6 +50,19 @@ public function testIndefiniteArticleForTypeInTypeCheckErrorMessage($type, $word
4950
$this->assertTypeConstraintError(ucwords($label)." value found, but $wording is required", $constraint);
5051
}
5152

53+
/**
54+
* Test uncovered areas of the loose type checker
55+
*/
56+
public function testLooseTypeChecking()
57+
{
58+
$v = new \StdClass();
59+
$v->property = 'dataOne';
60+
LooseTypeCheck::propertySet($v, 'property', 'dataTwo');
61+
$this->assertEquals('dataTwo', $v->property);
62+
$this->assertEquals('dataTwo', LooseTypeCheck::propertyGet($v, 'property'));
63+
$this->assertEquals(1, LooseTypeCheck::propertyCount($v));
64+
}
65+
5266
/**
5367
* Helper to assert an error message
5468
*

0 commit comments

Comments
 (0)