diff options
author | Marc Alexander <admin@m-a-styles.de> | 2013-01-08 21:58:03 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2013-01-08 21:58:03 +0100 |
commit | caa3516d134360c86b00c3f8104f3ac7157b0e47 (patch) | |
tree | 1d5aaf8945652686f449210d58f895384032b93d /tests/avatar/manager_test.php | |
parent | cb08bf3c0cac1f15ae46238a00a56ff7bf72efda (diff) | |
download | forums-caa3516d134360c86b00c3f8104f3ac7157b0e47.tar forums-caa3516d134360c86b00c3f8104f3ac7157b0e47.tar.gz forums-caa3516d134360c86b00c3f8104f3ac7157b0e47.tar.bz2 forums-caa3516d134360c86b00c3f8104f3ac7157b0e47.tar.xz forums-caa3516d134360c86b00c3f8104f3ac7157b0e47.zip |
[feature/avatars] Differentiate tests for get drivers functions
Tests for get_all_drivers() and get_enabled_drivers() should be different.
PHPBB3-10018
Diffstat (limited to 'tests/avatar/manager_test.php')
-rw-r--r-- | tests/avatar/manager_test.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php index fd7132ea82..f01ea47c25 100644 --- a/tests/avatar/manager_test.php +++ b/tests/avatar/manager_test.php @@ -26,12 +26,20 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase $config = new phpbb_config(array());
$request = $this->getMock('phpbb_request');
$cache = $this->getMock('phpbb_cache_driver_interface');
+
$this->avatar_foobar = $this->getMock('phpbb_avatar_driver_foobar', array('get_name'), array($config, $phpbb_root_path, $phpEx, $cache));
$this->avatar_foobar->expects($this->any())
->method('get_name')
->will($this->returnValue('avatar.driver.foobar'));
- $avatar_drivers = array($this->avatar_foobar);
+ $this->avatar_barfoo = $this->getMock('phpbb_avatar_driver_barfoo', array('get_name'));
+ $this->avatar_barfoo->expects($this->any())
+ ->method('get_name')
+ ->will($this->returnValue('avatar.driver.barfoo'));
+
+ $avatar_drivers = array($this->avatar_foobar, $this->avatar_barfoo);
+
$config['allow_avatar_' . get_class($this->avatar_foobar)] = true;
+ $config['allow_avatar_' . get_class($this->avatar_barfoo)] = false;
// Set up avatar manager
$this->manager = new phpbb_avatar_manager($config, $avatar_drivers, $this->phpbb_container);
@@ -56,13 +64,16 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase {
$drivers = $this->manager->get_all_drivers();
$this->assertArrayHasKey('avatar.driver.foobar', $drivers);
+ $this->assertArrayHasKey('avatar.driver.barfoo', $drivers);
$this->assertEquals('avatar.driver.foobar', $drivers['avatar.driver.foobar']);
+ $this->assertEquals('avatar.driver.barfoo', $drivers['avatar.driver.barfoo']);
}
public function test_get_enabled_drivers()
{
$drivers = $this->manager->get_enabled_drivers();
$this->assertArrayHasKey('avatar.driver.foobar', $drivers);
+ $this->assertArrayNotHasKey('avatar.driver.barfoo', $drivers);
$this->assertEquals('avatar.driver.foobar', $drivers['avatar.driver.foobar']);
}
|