コード例 #1
0
ファイル: ValidatorTest.php プロジェクト: nilamdoc/KYCGlobal
 public function testBooleanValidation()
 {
     $this->assertTrue(Validator::isBoolean(true));
     $this->assertTrue(Validator::isBoolean(false));
     $this->assertTrue(Validator::isBoolean('true'));
     $this->assertTrue(Validator::isBoolean('false'));
     $this->assertTrue(Validator::isBoolean(0));
     $this->assertTrue(Validator::isBoolean(1));
     $this->assertTrue(Validator::isBoolean('0'));
     $this->assertTrue(Validator::isBoolean('1'));
     $this->assertTrue(Validator::isBoolean('on'));
     $this->assertTrue(Validator::isBoolean('off'));
     $this->assertTrue(Validator::isBoolean('yes'));
     $this->assertTrue(Validator::isBoolean('no'));
     $this->assertTrue(Validator::isBoolean(''));
     $this->assertFalse(Validator::isBoolean('11'));
     $this->assertFalse(Validator::isBoolean('-1'));
     $this->assertFalse(Validator::isBoolean(-1));
     $this->assertFalse(Validator::isBoolean(11));
     $this->assertFalse(Validator::isBoolean(null));
     $this->assertFalse(Validator::isBoolean('test'));
 }
コード例 #2
0
ファイル: ValidatorTest.php プロジェクト: WarToaster/HangOn
 public function testBooleanValidation()
 {
     $this->assertTrue(Validator::isBoolean(true));
     $this->assertTrue(Validator::isBoolean(false));
     $this->assertTrue(Validator::isBoolean(0));
     $this->assertTrue(Validator::isBoolean(1));
     $this->assertTrue(Validator::isBoolean('0'));
     $this->assertTrue(Validator::isBoolean('1'));
     $this->assertFalse(Validator::isBoolean('11'));
     $this->assertFalse(Validator::isBoolean('-1'));
     $this->assertFalse(Validator::isBoolean(-1));
     $this->assertFalse(Validator::isBoolean(11));
     $this->assertFalse(Validator::isBoolean(null));
 }