/** * Tests Frapi_Action->getByKey() for TYPE_BOOL * * @dataProvider boolProvider */ public function testBool($input, $expect) { $actionParams = array('key1' => $input); $action = MockFrapi_Action::getInstance('Public'); $action->setActionParams($actionParams); $param = $action->testGetParam('key1', Action_Public::TYPE_BOOL); $this->assertEquals($param, $expect); }
/** * Prepares the environment before running a test. */ protected function setUp() { parent::setUp(); $_SERVER['HTTP_HOST'] = 'testing'; $this->_action = MockFrapi_Action::getInstance('public'); $params = array('public_test' => 'publicActionTest'); $this->_action->setActionParams($params); }
/** * Makes sure that the default parameter returns if the key doesn't exist * This tests with a set of parameters set on the action, but not the key * we are looking for. */ public function testUseDefaultValueInGetParamWithParamList() { $actionParams = array('key1' => 'value1'); $action = MockFrapi_Action::getInstance('Public'); $action->setActionParams($actionParams); $param = $action->testGetParam('key2', Action_Public::TYPE_INTEGER, 20); $this->assertEquals($param, 20); }
/** * Tests Frapi_Action->hasParam() when a parameter is not passed */ public function testHasParamWhenNotPassed() { $actionParams = array('key1' => 'value1'); $action = MockFrapi_Action::getInstance('Public'); $action->setActionParams($actionParams); $this->assertFalse($action->testHasParam('key2')); }