Example #1
0
 /**
  * Testing the postCheckbox() method of the Request class
  */
 public function testPostCheckbox()
 {
     // Weird side-fact: a checked checkbox that has no manually set value will mostly contain 'on' as the default
     // value in most modern browsers btw, so it makes sense to test this
     $_POST['checkboxName'] = 'on';
     $this->assertEquals(1, Request::postCheckbox('checkboxName'));
     $_POST['checkboxName'] = 1;
     $this->assertEquals(1, Request::postCheckbox('checkboxName'));
     $_POST['checkboxName'] = null;
     $this->assertEquals(null, Request::postCheckbox('checkboxName'));
 }