/** * Tests whether this Response object should respond to the request ($q). * * First the method is tested. * * Using the information in $params passed on object creation, this * method tests that information against the query information ($q). * * @param folksoQuery $q * @uses method * @return boolean */ function activatep(folksoQuery $q) { if ($q->method() == $this->method && $this->param_check($q)) { return true; } return $false; }
function testMethodStuff() { $q = new folksoQuery(array('REQUEST_METHOD' => 'GET'), array('folksores' => 1234), array()); $this->assertIsA($q, folksoQuery, 'Problem with object creation'); $this->assertEqual($q->method(), 'get', 'Reporting incorrect method'); $this->assertFalse($q->is_write_method, 'is_write_method should report false on GET'); $qq = new folksoQuery(array('REQUEST_METHOD' => 'POST'), array('folksostuff' => 'hoohoa'), array()); $this->assertEqual($qq->method(), 'post', 'Reporting incorrect method, should be post'); $this->assertTrue($qq->is_write_method(), 'Is write method should say true on POST'); }
/** * "True" means authorization _is_ necessary, false means it isn't. We * could check the fields for some GETs here too, to see if this is an * individualized GET request. (Or maybe it isn't necessary to do so * either.) * * @param folksoQuery $q */ function is_auth_necessary(folksoQuery $q) { return false; if ($q->method() == 'get' || $q->method() == 'head' || $this->clientAccessRestrict == 'LOCAL') { return false; } else { return true; } }