setSetting() public method

set the setting
Since: 3.0.0
public setSetting ( string $key = null, string $value = null ) : boolean
$key string key of the item
$value string value of the item
return boolean
Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
 /**
  * tearDownAfterClass
  *
  * @since 3.0.0
  */
 public static function tearDownAfterClass()
 {
     Db::setSetting('captcha', 0);
     Db::setSetting('notification', 0);
 }
Ejemplo n.º 3
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);
 }
Ejemplo n.º 4
0
 /**
  * tearDownAfterClass
  *
  * @since 3.0.0
  */
 public static function tearDownAfterClass()
 {
     Db::setSetting('captcha', 0);
     Db::forTablePrefix('users')->whereIdIs(1)->findOne()->set('password', 'test')->save();
 }
Ejemplo n.º 5
0
 /**
  * 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);
 }
Ejemplo n.º 6
0
 /**
  * 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);
 }