aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2015-05-05 18:17:14 +0200
committerJoas Schilling <nickvergessen@gmx.de>2015-05-05 18:17:14 +0200
commitde687f32ed8df438cb798d98f1a5dda7a5ac76dc (patch)
tree346e51469449521e40a25d875bcc3f7b8d7846f7 /tests
parentba53901ffb734995b42626a71a81a5abaa55f85d (diff)
parent51376a43919cba7a5037edb7cc31f18b5950437b (diff)
downloadforums-de687f32ed8df438cb798d98f1a5dda7a5ac76dc.tar
forums-de687f32ed8df438cb798d98f1a5dda7a5ac76dc.tar.gz
forums-de687f32ed8df438cb798d98f1a5dda7a5ac76dc.tar.bz2
forums-de687f32ed8df438cb798d98f1a5dda7a5ac76dc.tar.xz
forums-de687f32ed8df438cb798d98f1a5dda7a5ac76dc.zip
Merge pull request #3432 from Nicofuma/ticket/13638
[ticket/13638] Prepend the assets path phpbb root
Diffstat (limited to 'tests')
-rw-r--r--tests/controller/common_helper_route.php1
-rw-r--r--tests/extension/metadata_manager_test.php6
-rw-r--r--tests/template/asset_test.php49
-rw-r--r--tests/template/template_allfolder_test.php5
-rw-r--r--tests/template/template_events_test.php3
-rw-r--r--tests/template/template_includecss_test.php5
-rw-r--r--tests/template/template_test_case.php5
-rw-r--r--tests/template/template_test_case_with_tree.php5
8 files changed, 73 insertions, 6 deletions
diff --git a/tests/controller/common_helper_route.php b/tests/controller/common_helper_route.php
index 3e4b5fd38d..b01241e105 100644
--- a/tests/controller/common_helper_route.php
+++ b/tests/controller/common_helper_route.php
@@ -94,6 +94,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
$loader = new \phpbb\template\twig\loader($this->filesystem, '');
$twig = new \phpbb\template\twig\environment(
$this->config,
+ $this->filesystem,
$this->phpbb_path_helper,
$container,
$cache_path,
diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php
index 101ab8616c..aaaee3b2e5 100644
--- a/tests/extension/metadata_manager_test.php
+++ b/tests/extension/metadata_manager_test.php
@@ -51,17 +51,19 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$cache_path = $this->phpbb_root_path . 'cache/twig';
$context = new \phpbb\template\context();
$loader = new \phpbb\template\twig\loader(new \phpbb\filesystem\filesystem(), '');
- $phpbb_path_helper =new \phpbb\path_helper(
+ $filesystem = new \phpbb\filesystem\filesystem();
+ $phpbb_path_helper = new \phpbb\path_helper(
new \phpbb\symfony_request(
new phpbb_mock_request()
),
- new \phpbb\filesystem\filesystem(),
+ $filesystem,
$this->getMock('\phpbb\request\request'),
$this->phpbb_root_path,
$this->phpEx
);
$twig = new \phpbb\template\twig\environment(
$this->config,
+ $filesystem,
$phpbb_path_helper,
$container,
$cache_path,
diff --git a/tests/template/asset_test.php b/tests/template/asset_test.php
new file mode 100644
index 0000000000..f6ce0fe241
--- /dev/null
+++ b/tests/template/asset_test.php
@@ -0,0 +1,49 @@
+<?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\template\asset;
+
+class phpbb_template_asset_test extends phpbb_test_case
+{
+ public function set_path_data()
+ {
+ return array(
+ // array(phpbb_root_path, given path, expected path),
+ array('.', 'foo/bar', 'foo/bar'),
+ array('../', 'foo/bar', 'foo/bar'),
+ array('./phpBB/', 'foo/bar', 'foo/bar'),
+ array('../', __DIR__ . '/foo/bar', '../phpbb/tests/template/foo/bar'),
+ array('./', __DIR__ . '/foo/bar', './tests/template/foo/bar'),
+ array('./phpBB/', __DIR__ . '/foo/bar', 'tests/template/foo/bar'),
+ );
+ }
+
+ /**
+ * @dataProvider set_path_data
+ */
+ public function test_set_path($phpbb_root_path, $path, $expected)
+ {
+ $path_helper = $this->getMockBuilder('\phpbb\path_helper')
+ ->disableOriginalConstructor()
+ ->setMethods(array())
+ ->getMock();
+
+ $path_helper->method('get_phpbb_root_path')
+ ->willReturn($phpbb_root_path);
+
+ $asset = new asset('', $path_helper, new phpbb\filesystem\filesystem());
+
+ $asset->set_path($path, true);
+ $this->assertEquals($expected, $asset->get_path());
+ }
+}
diff --git a/tests/template/template_allfolder_test.php b/tests/template/template_allfolder_test.php
index 63f35bc758..14a8e9d463 100644
--- a/tests/template/template_allfolder_test.php
+++ b/tests/template/template_allfolder_test.php
@@ -33,11 +33,13 @@ class phpbb_template_allfolder_test extends phpbb_template_template_test_case
$user = new \phpbb\user($lang, '\phpbb\datetime');
$this->user = $user;
+ $filesystem = new \phpbb\filesystem\filesystem();
+
$path_helper = new \phpbb\path_helper(
new \phpbb\symfony_request(
new phpbb_mock_request()
),
- new \phpbb\filesystem\filesystem(),
+ $filesystem,
$this->getMock('\phpbb\request\request'),
$phpbb_root_path,
$phpEx
@@ -60,6 +62,7 @@ class phpbb_template_allfolder_test extends phpbb_template_template_test_case
$loader = new \phpbb\template\twig\loader(new \phpbb\filesystem\filesystem(), '');
$twig = new \phpbb\template\twig\environment(
$config,
+ $filesystem,
$path_helper,
$container,
$cache_path,
diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php
index 6d1b7253e3..285e82188b 100644
--- a/tests/template/template_events_test.php
+++ b/tests/template/template_events_test.php
@@ -138,6 +138,8 @@ Zeta test event in all',
$this->extension_manager = new phpbb_mock_filesystem_extension_manager(
dirname(__FILE__) . "/datasets/$dataset/"
);
+
+ $filesystem = new \phpbb\filesystem\filesystem();
$path_helper = new \phpbb\path_helper(
new \phpbb\symfony_request(
new phpbb_mock_request()
@@ -154,6 +156,7 @@ Zeta test event in all',
$loader = new \phpbb\template\twig\loader(new \phpbb\filesystem\filesystem(), '');
$twig = new \phpbb\template\twig\environment(
$config,
+ $filesystem,
$path_helper,
$container,
$cache_path,
diff --git a/tests/template/template_includecss_test.php b/tests/template/template_includecss_test.php
index 7a73d1f888..8c398d992b 100644
--- a/tests/template/template_includecss_test.php
+++ b/tests/template/template_includecss_test.php
@@ -28,11 +28,13 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te
$defaults = $this->config_defaults();
$config = new \phpbb\config\config(array_merge($defaults, $new_config));
+ $filesystem = new \phpbb\filesystem\filesystem();
+
$this->phpbb_path_helper = new \phpbb\path_helper(
new \phpbb\symfony_request(
new phpbb_mock_request()
),
- new \phpbb\filesystem\filesystem(),
+ $filesystem,
$this->getMock('\phpbb\request\request'),
$phpbb_root_path,
$phpEx
@@ -46,6 +48,7 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te
$loader = new \phpbb\template\twig\loader(new \phpbb\filesystem\filesystem(), '');
$twig = new \phpbb\template\twig\environment(
$config,
+ $filesystem,
$this->phpbb_path_helper,
$container,
$cache_path,
diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php
index 7e2020ba09..b1826571af 100644
--- a/tests/template/template_test_case.php
+++ b/tests/template/template_test_case.php
@@ -82,11 +82,13 @@ class phpbb_template_template_test_case extends phpbb_test_case
$user = new \phpbb\user($lang, '\phpbb\datetime');
$this->user = $user;
+ $filesystem = new \phpbb\filesystem\filesystem();
+
$path_helper = new \phpbb\path_helper(
new \phpbb\symfony_request(
new phpbb_mock_request()
),
- new \phpbb\filesystem\filesystem(),
+ $filesystem,
$this->getMock('\phpbb\request\request'),
$phpbb_root_path,
$phpEx
@@ -100,6 +102,7 @@ class phpbb_template_template_test_case extends phpbb_test_case
$loader = new \phpbb\template\twig\loader(new \phpbb\filesystem\filesystem(), '');
$twig = new \phpbb\template\twig\environment(
$config,
+ $filesystem,
$path_helper,
$container,
$cache_path,
diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php
index eab83f379a..d0c49006fd 100644
--- a/tests/template/template_test_case_with_tree.php
+++ b/tests/template/template_test_case_with_tree.php
@@ -22,11 +22,13 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat
$defaults = $this->config_defaults();
$config = new \phpbb\config\config(array_merge($defaults, $new_config));
+ $filesystem = new \phpbb\filesystem\filesystem();
+
$this->phpbb_path_helper = new \phpbb\path_helper(
new \phpbb\symfony_request(
new phpbb_mock_request()
),
- new \phpbb\filesystem\filesystem(),
+ $filesystem,
$this->getMock('\phpbb\request\request'),
$phpbb_root_path,
$phpEx
@@ -41,6 +43,7 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat
$loader = new \phpbb\template\twig\loader(new \phpbb\filesystem\filesystem(), '');
$twig = new \phpbb\template\twig\environment(
$config,
+ $filesystem,
$this->phpbb_path_helper,
$container,
$cache_path,