From be9d21399c7d1b51fd88aa2bb014090b12dbf6c5 Mon Sep 17 00:00:00 2001 From: Victor Bjelkholm Date: Mon, 14 Jul 2014 13:45:44 +0200 Subject: [PATCH] Uncomment CC test cases and add alternative syntax tests --- tests/Valitron/ValidateTest.php | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/tests/Valitron/ValidateTest.php b/tests/Valitron/ValidateTest.php index cb6f98f..4d2c2c6 100644 --- a/tests/Valitron/ValidateTest.php +++ b/tests/Valitron/ValidateTest.php @@ -749,8 +749,6 @@ class ValidateTest extends BaseTestCase $this->assertFalse($v->validate()); } -/* - public function testCreditCardValid() { $visa = array(4539511619543489, 4532949059629052, 4024007171194938, 4929646403373269, 4539135861690622); @@ -802,7 +800,6 @@ class ValidateTest extends BaseTestCase } } } - */ public function testInstanceOfValidWithString() { @@ -832,6 +829,29 @@ class ValidateTest extends BaseTestCase $this->assertFalse($v->validate()); } + public function testInstanceOfWithAlternativeSyntaxValid() + { + $v = new Validator(array('attributeName' => new stdClass())); + $v->rules(array( + 'instanceOf' => array( + array('attributeName', 'stdClass') + ) + )); + $this->assertTrue($v->validate()); + } + + public function testInstanceOfWithAlternativeSyntaxInvalid() + { + $v = new Validator(array('attributeName' => new stdClass())); + $v->rules(array( + 'instanceOf' => array( + array('attributeName', 'SomeOtherClassInAlternativeSyntaxInvalid') + ) + )); + $v->validate(); + $this->assertFalse($v->validate()); + } + } function sampleFunctionCallback($field, $value, array $params) {