aboutsummaryrefslogtreecommitdiffstats
path: root/tests/installer
diff options
context:
space:
mode:
authorMate Bartus <mate.bartus@gmail.com>2015-07-08 01:27:05 +0200
committerMate Bartus <mate.bartus@gmail.com>2015-07-08 01:28:12 +0200
commit612eead5a9932d459d8b65f9217f895c33b51c39 (patch)
tree8e17c8ec265b26c96e400a515352bdb5520f534d /tests/installer
parent9d54867485300eefe7fcd8e8c2080eb655e713ed (diff)
downloadforums-612eead5a9932d459d8b65f9217f895c33b51c39.tar
forums-612eead5a9932d459d8b65f9217f895c33b51c39.tar.gz
forums-612eead5a9932d459d8b65f9217f895c33b51c39.tar.bz2
forums-612eead5a9932d459d8b65f9217f895c33b51c39.tar.xz
forums-612eead5a9932d459d8b65f9217f895c33b51c39.zip
[ticket/13740] Installer config test
PHPBB3-13740
Diffstat (limited to 'tests/installer')
-rw-r--r--tests/installer/installer_config_test.php86
1 files changed, 86 insertions, 0 deletions
diff --git a/tests/installer/installer_config_test.php b/tests/installer/installer_config_test.php
new file mode 100644
index 0000000000..d1110bf8f8
--- /dev/null
+++ b/tests/installer/installer_config_test.php
@@ -0,0 +1,86 @@
+<?php
+/**
+ *
+ * This file is part of the phpBB Forum Software package.
+ *
+ * @copyright (c) phpBB Limited <https://www.phpbb.com>
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ * For full copyright and license information, please see
+ * the docs/CREDITS.txt file.
+ *
+ */
+
+use phpbb\install\helper\config;
+
+class phpbb_installer_config_test extends phpbb_test_case
+{
+ /**
+ * @var \phpbb\install\helper\config
+ */
+ private $config;
+
+ public function setUp()
+ {
+ $phpbb_root_path = __DIR__ . './../../phpBB/';
+ $filesystem = $this->getMock('\phpbb\filesystem\filesystem');
+ $php_ini = $this->getMockBuilder('\phpbb\php\ini')
+ ->method('get_int')
+ ->willReturn(-1)
+ ->method('get_bytes')
+ ->willReturn(-1)
+ ->getMock();
+
+ $this->config = new config($filesystem, $php_ini, $phpbb_root_path);
+ }
+
+ /**
+ * @covers config::set
+ * @covers config::get
+ */
+ public function test_set_get_var()
+ {
+ $this->config->set('foo', 'bar');
+ $this->assertEquals('bar', $this->config->get('foo'));
+ }
+
+ public function test_get_time_remaining()
+ {
+ $this->assertGreaterThan(0, $this->config->get_time_remaining());
+ }
+
+ public function test_get_memory_remaining()
+ {
+ $this->assertGreaterThan(0, $this->config->get_memory_remaining());
+ }
+
+ /**
+ * @covers config::set_finished_task
+ * @covers config::set_active_module
+ * @covers config::set_task_progress_count
+ * @covers config::increment_current_task_progress
+ * @covers config::get_progress_data
+ */
+ public function test_progress_tracking()
+ {
+ $this->config->set_finished_task('foo', 3);
+ $this->config->set_active_module('bar', 4);
+ $this->config->set_task_progress_count(10);
+ $this->config->increment_current_task_progress();
+
+ $this->assertContains(array('current_task_progress' => 1), $this->config->get_progress_data());
+
+ $this->config->increment_current_task_progress(2);
+
+ $this->assertEquals(array(
+ 'last_task_module_index' => 4,
+ 'last_task_module_name' => 'bar', // Stores the service name of the latest finished module
+ 'last_task_index' => 3,
+ 'last_task_name' => 'foo', // Stores the service name of the latest finished task
+ 'max_task_progress' => 10,
+ 'current_task_progress' => 3,
+ ),
+ $this->config->get_progress_data()
+ );
+ }
+}