mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/10202] Rename method names _all() to _array().
PHPBB3-10202
This commit is contained in:
parent
3a4b34ca32
commit
32ff2348f1
2 changed files with 17 additions and 17 deletions
|
@ -56,7 +56,7 @@ class phpbb_config_db_text
|
||||||
*/
|
*/
|
||||||
public function set($key, $value)
|
public function set($key, $value)
|
||||||
{
|
{
|
||||||
$this->set_all(array($key => $value));
|
$this->set_array(array($key => $value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,7 +69,7 @@ class phpbb_config_db_text
|
||||||
*/
|
*/
|
||||||
public function get($key)
|
public function get($key)
|
||||||
{
|
{
|
||||||
$map = $this->get_all(array($key));
|
$map = $this->get_array(array($key));
|
||||||
|
|
||||||
return isset($map[$key]) ? $map[$key] : null;
|
return isset($map[$key]) ? $map[$key] : null;
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ class phpbb_config_db_text
|
||||||
*/
|
*/
|
||||||
public function delete($key)
|
public function delete($key)
|
||||||
{
|
{
|
||||||
$this->delete_all(array($key));
|
$this->delete_array(array($key));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -95,7 +95,7 @@ class phpbb_config_db_text
|
||||||
*
|
*
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
public function set_all(array $map)
|
public function set_array(array $map)
|
||||||
{
|
{
|
||||||
$this->db->sql_transaction('begin');
|
$this->db->sql_transaction('begin');
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ class phpbb_config_db_text
|
||||||
*
|
*
|
||||||
* @return array Map from configuration names to values
|
* @return array Map from configuration names to values
|
||||||
*/
|
*/
|
||||||
public function get_all(array $keys)
|
public function get_array(array $keys)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT *
|
||||||
FROM ' . $this->table . '
|
FROM ' . $this->table . '
|
||||||
|
@ -153,7 +153,7 @@ class phpbb_config_db_text
|
||||||
*
|
*
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
public function delete_all(array $keys)
|
public function delete_array(array $keys)
|
||||||
{
|
{
|
||||||
$sql = 'DELETE
|
$sql = 'DELETE
|
||||||
FROM ' . $this->table . '
|
FROM ' . $this->table . '
|
||||||
|
|
|
@ -64,48 +64,48 @@ class phpbb_config_db_text_test extends phpbb_database_test_case
|
||||||
$this->assertSame('string-de-ding', $this->config_text->get('meh'));
|
$this->assertSame('string-de-ding', $this->config_text->get('meh'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_get_all_empty()
|
public function test_get_array_empty()
|
||||||
{
|
{
|
||||||
$this->assertEmpty($this->config_text->get_all(array('key1', 'key2')));
|
$this->assertEmpty($this->config_text->get_array(array('key1', 'key2')));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_get_all_subset()
|
public function test_get_array_subset()
|
||||||
{
|
{
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'bar' => '42',
|
'bar' => '42',
|
||||||
'foo' => '23',
|
'foo' => '23',
|
||||||
);
|
);
|
||||||
|
|
||||||
$actual = $this->config_text->get_all(array_keys($expected));
|
$actual = $this->config_text->get_array(array_keys($expected));
|
||||||
ksort($actual);
|
ksort($actual);
|
||||||
|
|
||||||
$this->assertSame($expected, $actual);
|
$this->assertSame($expected, $actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_set_all_get_all_subset()
|
public function test_set_array_get_array_subset()
|
||||||
{
|
{
|
||||||
$set_all_param = array(
|
$set_array_param = array(
|
||||||
// New entry
|
// New entry
|
||||||
'baby' => 'phpBB',
|
'baby' => 'phpBB',
|
||||||
// Entry update
|
// Entry update
|
||||||
'bar' => '64',
|
'bar' => '64',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->config_text->set_all($set_all_param);
|
$this->config_text->set_array($set_array_param);
|
||||||
|
|
||||||
$expected = array_merge($set_all_param, array(
|
$expected = array_merge($set_array_param, array(
|
||||||
'foo' => '23',
|
'foo' => '23',
|
||||||
));
|
));
|
||||||
|
|
||||||
$actual = $this->config_text->get_all(array_keys($expected));
|
$actual = $this->config_text->get_array(array_keys($expected));
|
||||||
ksort($actual);
|
ksort($actual);
|
||||||
|
|
||||||
$this->assertSame($expected, $actual);
|
$this->assertSame($expected, $actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_delete_all_get_remaining()
|
public function test_delete_array_get_remaining()
|
||||||
{
|
{
|
||||||
$this->config_text->delete_all(array('foo', 'bar'));
|
$this->config_text->delete_array(array('foo', 'bar'));
|
||||||
|
|
||||||
$this->assertNull($this->config_text->get('bar'));
|
$this->assertNull($this->config_text->get('bar'));
|
||||||
$this->assertNull($this->config_text->get('foo'));
|
$this->assertNull($this->config_text->get('foo'));
|
||||||
|
|
Loading…
Add table
Reference in a new issue