/** * set the setting * * @since 3.0.0 * * @param array $optionArray * * @return boolean */ protected function _set($optionArray = []) { $key = $this->prompt('key', $optionArray); $value = $this->prompt('value', $optionArray); if ($key && $value) { return Db::setSetting($key, $value); } return false; }
/** * tearDownAfterClass * * @since 3.0.0 */ public static function tearDownAfterClass() { Db::setSetting('captcha', 0); Db::setSetting('notification', 0); }
/** * testMailFailure * * @since 3.0.0 * * @param array $postArray * @param array $hashArray * @param array $settingArray * @param string $expect * * @dataProvider providerMailFailure */ public function testMailFailure($postArray = [], $hashArray = [], $settingArray = [], $expect = null) { /* setup */ Db::setSetting('notification', $settingArray['notification']); Db::setSetting('moderation', $settingArray['moderation']); $this->_request->set('post', $postArray); $this->_request->setPost('solution', function_exists('password_verify') ? $hashArray[0] : $hashArray[1]); $stub = $this->getMockBuilder('Redaxscript\\Controller\\Comment')->setConstructorArgs([$this->_registry, $this->_language, $this->_request])->setMethods(['_mail'])->getMock(); /* override */ $stub->expects($this->any())->method('_mail')->will($this->returnValue(false)); /* actual */ $actual = $stub->process(); /* compare */ $this->assertEquals($expect, $actual); }
/** * tearDownAfterClass * * @since 3.0.0 */ public static function tearDownAfterClass() { Db::setSetting('captcha', 0); Db::forTablePrefix('users')->whereIdIs(1)->findOne()->set('password', 'test')->save(); }
/** * testGetAndSetSetting * * @since 2.2.0 */ public function testGetAndSetSetting() { /* setup */ Db::setSetting('charset', 'utf-8'); /* actual */ $actual = Db::getSetting('charset'); /* compare */ $this->assertEquals('utf-8', $actual); }
/** * testProcess * * @since 3.0.0 * * @param array $postArray * @param array $hashArray * @param array $settingArray * @param string $expect * * @dataProvider providerProcess */ public function testProcess($postArray = [], $hashArray = [], $settingArray = [], $expect = null) { /* setup */ Db::setSetting('notification', $settingArray['notification']); Db::setSetting('moderation', $settingArray['moderation']); $this->_request->set('post', $postArray); $this->_request->setPost('solution', function_exists('password_verify') ? $hashArray[0] : $hashArray[1]); $commentController = new Controller\Comment($this->_registry, $this->_language, $this->_request); /* actual */ $actual = $commentController->process(); /* compare */ $this->assertEquals($expect, $actual); }