boolean() public static method

public static boolean ( $value )
Ejemplo n.º 1
0
 /**
  * @testdox boolean should return false to true as string
  */
 public function testInvalidBooleanWithTrue()
 {
     $value = 'true';
     $this->assertFalse(Validation::boolean($value));
 }
Ejemplo n.º 2
0
 /**
  * testBoolean method
  *
  * @return void
  */
 public function testBoolean()
 {
     $this->assertTrue(Validation::boolean('0'));
     $this->assertTrue(Validation::boolean('1'));
     $this->assertTrue(Validation::boolean(0));
     $this->assertTrue(Validation::boolean(1));
     $this->assertTrue(Validation::boolean(true));
     $this->assertTrue(Validation::boolean(false));
     $this->assertFalse(Validation::boolean('true'));
     $this->assertFalse(Validation::boolean('false'));
     $this->assertFalse(Validation::boolean('-1'));
     $this->assertFalse(Validation::boolean('2'));
     $this->assertFalse(Validation::boolean('Boo!'));
 }
Ejemplo n.º 3
0
 public function testValidBooleanWithBooleanFalse()
 {
     $value = false;
     $this->assertTrue(Validation::boolean($value));
 }