mirror of
https://github.com/phpbb/phpbb.git
synced 2025-01-17 22:28:46 +01:00
[ticket/16924] Add test to cover potential escaping of json values
PHPBB3-16924
This commit is contained in:
parent
39905eaf4b
commit
03b36d46c3
@ -86,6 +86,17 @@ class phpbb_config_db_test extends phpbb_database_test_case
|
|||||||
$this->cache->checkVar($this, 'config', array('foo' => '23', 'foobar' => '5'));
|
$this->cache->checkVar($this, 'config', array('foo' => '23', 'foobar' => '5'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_set_new_json()
|
||||||
|
{
|
||||||
|
$json_value = '{"menu":{"id":"file","value":"File"}}';
|
||||||
|
$this->config->set('foobar_json', $json_value);
|
||||||
|
$this->assertEquals($json_value, $this->config['foobar_json']);
|
||||||
|
|
||||||
|
// re-read config and populate cache
|
||||||
|
$config2 = new \phpbb\config\db($this->db, $this->cache, 'phpbb_config');
|
||||||
|
$this->cache->checkVar($this, 'config', array('foo' => '23', 'foobar' => '5', 'foobar_json' => $json_value));
|
||||||
|
}
|
||||||
|
|
||||||
public function test_set_new_uncached()
|
public function test_set_new_uncached()
|
||||||
{
|
{
|
||||||
$this->config->set('foobar', '5', false);
|
$this->config->set('foobar', '5', false);
|
||||||
|
@ -46,6 +46,13 @@ class phpbb_config_db_text_test extends phpbb_database_test_case
|
|||||||
$this->assertSame('phpbb', $this->config_text->get('barz'));
|
$this->assertSame('phpbb', $this->config_text->get('barz'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_set_new_get_json()
|
||||||
|
{
|
||||||
|
$json_value = '{"menu":{"id":"file","value":"File"}}';
|
||||||
|
$this->config_text->set('foobar_json', $json_value);
|
||||||
|
$this->assertEquals($json_value, $this->config_text->get('foobar_json'));
|
||||||
|
}
|
||||||
|
|
||||||
public function test_set_replace_get()
|
public function test_set_replace_get()
|
||||||
{
|
{
|
||||||
$this->config_text->set('foo', '24');
|
$this->config_text->set('foo', '24');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user