/** * Tests that different Postgres boolean 'flavors' are properly returned as native PHP booleans * * @access public * @return void */ function testBooleanNormalization() { $this->assertTrue($this->db2->boolean('t')); $this->assertTrue($this->db2->boolean('true')); $this->assertTrue($this->db2->boolean('TRUE')); $this->assertTrue($this->db2->boolean(true)); $this->assertTrue($this->db2->boolean(1)); $this->assertTrue($this->db2->boolean(" ")); $this->assertFalse($this->db2->boolean('f')); $this->assertFalse($this->db2->boolean('false')); $this->assertFalse($this->db2->boolean('FALSE')); $this->assertFalse($this->db2->boolean(false)); $this->assertFalse($this->db2->boolean(0)); $this->assertFalse($this->db2->boolean('')); }
/** * Tests that different Postgres boolean 'flavors' are properly returned as native PHP booleans * * @return void */ public function testBooleanNormalization() { $this->assertEquals(true, $this->Dbo2->boolean('t', false)); $this->assertEquals(true, $this->Dbo2->boolean('true', false)); $this->assertEquals(true, $this->Dbo2->boolean('TRUE', false)); $this->assertEquals(true, $this->Dbo2->boolean(true, false)); $this->assertEquals(true, $this->Dbo2->boolean(1, false)); $this->assertEquals(true, $this->Dbo2->boolean(" ", false)); $this->assertEquals(false, $this->Dbo2->boolean('f', false)); $this->assertEquals(false, $this->Dbo2->boolean('false', false)); $this->assertEquals(false, $this->Dbo2->boolean('FALSE', false)); $this->assertEquals(false, $this->Dbo2->boolean(false, false)); $this->assertEquals(false, $this->Dbo2->boolean(0, false)); $this->assertEquals(false, $this->Dbo2->boolean('', false)); }
/** * Tests that different Postgres boolean 'flavors' are properly returned as native PHP booleans * * @return void */ public function testBooleanNormalization() { $this->assertEquals(TRUE, $this->Dbo2->boolean('t', FALSE)); $this->assertEquals(TRUE, $this->Dbo2->boolean('true', FALSE)); $this->assertEquals(TRUE, $this->Dbo2->boolean('TRUE', FALSE)); $this->assertEquals(TRUE, $this->Dbo2->boolean(TRUE, FALSE)); $this->assertEquals(TRUE, $this->Dbo2->boolean(1, FALSE)); $this->assertEquals(TRUE, $this->Dbo2->boolean(" ", FALSE)); $this->assertEquals(FALSE, $this->Dbo2->boolean('f', FALSE)); $this->assertEquals(FALSE, $this->Dbo2->boolean('false', FALSE)); $this->assertEquals(FALSE, $this->Dbo2->boolean('FALSE', FALSE)); $this->assertEquals(FALSE, $this->Dbo2->boolean(FALSE, FALSE)); $this->assertEquals(FALSE, $this->Dbo2->boolean(0, FALSE)); $this->assertEquals(FALSE, $this->Dbo2->boolean('', FALSE)); }