mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-30 03:30:17 +02:00
[ticket/11700] Move all recent code to namespaces
PHPBB3-11700
This commit is contained in:
@@ -11,7 +11,7 @@ class phpbb_config_test extends phpbb_test_case
|
||||
{
|
||||
public function test_offset_exists()
|
||||
{
|
||||
$config = new phpbb_config(array('foo' => 'bar'));
|
||||
$config = new \phpbb\config\config(array('foo' => 'bar'));
|
||||
|
||||
$this->assertTrue(isset($config['foo']));
|
||||
$this->assertFalse(isset($config['foobar']));
|
||||
@@ -19,19 +19,19 @@ class phpbb_config_test extends phpbb_test_case
|
||||
|
||||
public function test_offset_get()
|
||||
{
|
||||
$config = new phpbb_config(array('foo' => 'bar'));
|
||||
$config = new \phpbb\config\config(array('foo' => 'bar'));
|
||||
$this->assertEquals('bar', $config['foo']);
|
||||
}
|
||||
|
||||
public function test_offset_get_missing()
|
||||
{
|
||||
$config = new phpbb_config(array());
|
||||
$config = new \phpbb\config\config(array());
|
||||
$this->assertEquals('', $config['foo']);
|
||||
}
|
||||
|
||||
public function test_offset_set()
|
||||
{
|
||||
$config = new phpbb_config(array());
|
||||
$config = new \phpbb\config\config(array());
|
||||
$config['foo'] = 'x';
|
||||
$this->assertEquals('x', $config['foo']);
|
||||
}
|
||||
@@ -39,20 +39,20 @@ class phpbb_config_test extends phpbb_test_case
|
||||
public function test_offset_unset_fails()
|
||||
{
|
||||
$this->setExpectedTriggerError(E_USER_ERROR);
|
||||
$config = new phpbb_config(array('foo' => 'x'));
|
||||
$config = new \phpbb\config\config(array('foo' => 'x'));
|
||||
unset($config['foo']);
|
||||
}
|
||||
|
||||
public function test_count()
|
||||
{
|
||||
$config = new phpbb_config(array('foo' => 'bar'));
|
||||
$config = new \phpbb\config\config(array('foo' => 'bar'));
|
||||
$this->assertEquals(1, count($config));
|
||||
}
|
||||
|
||||
public function test_iterate()
|
||||
{
|
||||
$vars = array('foo' => '23', 'bar' => '42');
|
||||
$config = new phpbb_config($vars);
|
||||
$config = new \phpbb\config\config($vars);
|
||||
|
||||
$count = 0;
|
||||
foreach ($config as $key => $value)
|
||||
@@ -68,42 +68,42 @@ class phpbb_config_test extends phpbb_test_case
|
||||
|
||||
public function test_set_overwrite()
|
||||
{
|
||||
$config = new phpbb_config(array('foo' => 'x'));
|
||||
$config = new \phpbb\config\config(array('foo' => 'x'));
|
||||
$config->set('foo', 'bar');
|
||||
$this->assertEquals('bar', $config['foo']);
|
||||
}
|
||||
|
||||
public function test_set_new()
|
||||
{
|
||||
$config = new phpbb_config(array());
|
||||
$config = new \phpbb\config\config(array());
|
||||
$config->set('foo', 'bar');
|
||||
$this->assertEquals('bar', $config['foo']);
|
||||
}
|
||||
|
||||
public function test_set_atomic_overwrite()
|
||||
{
|
||||
$config = new phpbb_config(array('foo' => 'bar'));
|
||||
$config = new \phpbb\config\config(array('foo' => 'bar'));
|
||||
$this->assertTrue($config->set_atomic('foo', 'bar', '23'));
|
||||
$this->assertEquals('23', $config['foo']);
|
||||
}
|
||||
|
||||
public function test_set_atomic_new()
|
||||
{
|
||||
$config = new phpbb_config(array());
|
||||
$config = new \phpbb\config\config(array());
|
||||
$this->assertTrue($config->set_atomic('foo', false, '23'));
|
||||
$this->assertEquals('23', $config['foo']);
|
||||
}
|
||||
|
||||
public function test_set_atomic_failure()
|
||||
{
|
||||
$config = new phpbb_config(array('foo' => 'bar'));
|
||||
$config = new \phpbb\config\config(array('foo' => 'bar'));
|
||||
$this->assertFalse($config->set_atomic('foo', 'wrong', '23'));
|
||||
$this->assertEquals('bar', $config['foo']);
|
||||
}
|
||||
|
||||
public function test_increment()
|
||||
{
|
||||
$config = new phpbb_config(array('foo' => '23'));
|
||||
$config = new \phpbb\config\config(array('foo' => '23'));
|
||||
$config->increment('foo', 3);
|
||||
$this->assertEquals(26, $config['foo']);
|
||||
$config->increment('foo', 1);
|
||||
@@ -112,7 +112,7 @@ class phpbb_config_test extends phpbb_test_case
|
||||
|
||||
public function test_delete()
|
||||
{
|
||||
$config = new phpbb_config(array('foo' => 'bar'));
|
||||
$config = new \phpbb\config\config(array('foo' => 'bar'));
|
||||
|
||||
$config->delete('foo');
|
||||
$this->assertFalse(isset($config['foo']));
|
||||
|
@@ -24,7 +24,7 @@ class phpbb_config_db_test extends phpbb_database_test_case
|
||||
|
||||
$this->cache = new phpbb_mock_cache;
|
||||
$this->db = $this->new_dbal();
|
||||
$this->config = new phpbb_config_db($this->db, $this->cache, 'phpbb_config');
|
||||
$this->config = new \phpbb\config\db($this->db, $this->cache, '\phpbb\config\config');
|
||||
}
|
||||
|
||||
public function test_load_config()
|
||||
@@ -36,7 +36,7 @@ class phpbb_config_db_test extends phpbb_database_test_case
|
||||
public function test_load_cached()
|
||||
{
|
||||
$cache = new phpbb_mock_cache(array('config' => array('x' => 'y')));
|
||||
$this->config = new phpbb_config_db($this->db, $cache, 'phpbb_config');
|
||||
$this->config = new \phpbb\config\db($this->db, $cache, '\phpbb\config\config');
|
||||
|
||||
$this->assertTrue(!isset($this->config['foo']));
|
||||
$this->assertEquals('42', $this->config['bar']);
|
||||
@@ -49,7 +49,7 @@ class phpbb_config_db_test extends phpbb_database_test_case
|
||||
$this->config['foo'] = 'x'; // temporary set
|
||||
$this->assertEquals('x', $this->config['foo']);
|
||||
|
||||
$config2 = new phpbb_config_db($this->db, $this->cache, 'phpbb_config');
|
||||
$config2 = new \phpbb\config\db($this->db, $this->cache, '\phpbb\config\config');
|
||||
$this->assertEquals('23', $config2['foo']);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class phpbb_config_db_test extends phpbb_database_test_case
|
||||
$this->assertEquals('17', $this->config['foo']);
|
||||
|
||||
// re-read config and populate cache
|
||||
$config2 = new phpbb_config_db($this->db, $this->cache, 'phpbb_config');
|
||||
$config2 = new \phpbb\config\db($this->db, $this->cache, '\phpbb\config\config');
|
||||
$this->cache->checkVar($this, 'config', array('foo' => '17'));
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ class phpbb_config_db_test extends phpbb_database_test_case
|
||||
$this->config->set('bar', '17', false);
|
||||
|
||||
// re-read config and populate cache
|
||||
$config2 = new phpbb_config_db($this->db, $this->cache, 'phpbb_config');
|
||||
$config2 = new \phpbb\config\db($this->db, $this->cache, '\phpbb\config\config');
|
||||
$this->cache->checkVar($this, 'config', array('foo' => '23'));
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ class phpbb_config_db_test extends phpbb_database_test_case
|
||||
$this->assertEquals('5', $this->config['foobar']);
|
||||
|
||||
// re-read config and populate cache
|
||||
$config2 = new phpbb_config_db($this->db, $this->cache, 'phpbb_config');
|
||||
$config2 = new \phpbb\config\db($this->db, $this->cache, '\phpbb\config\config');
|
||||
$this->cache->checkVar($this, 'config', array('foo' => '23', 'foobar' => '5'));
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ class phpbb_config_db_test extends phpbb_database_test_case
|
||||
$this->assertEquals('5', $this->config['foobar']);
|
||||
|
||||
// re-read config and populate cache
|
||||
$config2 = new phpbb_config_db($this->db, $this->cache, 'phpbb_config');
|
||||
$config2 = new \phpbb\config\db($this->db, $this->cache, '\phpbb\config\config');
|
||||
$this->cache->checkVar($this, 'config', array('foo' => '23'));
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ class phpbb_config_db_test extends phpbb_database_test_case
|
||||
|
||||
// re-read config and populate cache
|
||||
$cache2 = new phpbb_mock_cache;
|
||||
$config2 = new phpbb_config_db($this->db, $cache2, 'phpbb_config');
|
||||
$config2 = new \phpbb\config\db($this->db, $cache2, '\phpbb\config\config');
|
||||
$cache2->checkVarUnset($this, 'foo');
|
||||
$this->assertFalse(isset($config2['foo']));
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ class phpbb_config_db_text_test extends phpbb_database_test_case
|
||||
parent::setUp();
|
||||
|
||||
$this->db = $this->new_dbal();
|
||||
$this->config_text = new phpbb_config_db_text($this->db, 'phpbb_config_text');
|
||||
$this->config_text = new \phpbb\config\db_text($this->db, 'phpbb_config_text');
|
||||
}
|
||||
|
||||
public function test_get()
|
||||
|
Reference in New Issue
Block a user