diff options
author | Nicofuma <github@nicofuma.fr> | 2015-02-22 22:43:53 +0100 |
---|---|---|
committer | Nicofuma <github@nicofuma.fr> | 2015-05-04 23:23:54 +0200 |
commit | 321ed2a3dd10231a09dec18a85a783a73ba12ddf (patch) | |
tree | 9a41832696cb4354c07e3a392bc9067b9369be6d /tests | |
parent | f097f84f16f32e8d9c0148907f0ae5743f09619f (diff) | |
download | forums-321ed2a3dd10231a09dec18a85a783a73ba12ddf.tar forums-321ed2a3dd10231a09dec18a85a783a73ba12ddf.tar.gz forums-321ed2a3dd10231a09dec18a85a783a73ba12ddf.tar.bz2 forums-321ed2a3dd10231a09dec18a85a783a73ba12ddf.tar.xz forums-321ed2a3dd10231a09dec18a85a783a73ba12ddf.zip |
[ticket/13638] Add tests
PHPBB3-13638
Diffstat (limited to 'tests')
-rw-r--r-- | tests/template/asset_test.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/template/asset_test.php b/tests/template/asset_test.php new file mode 100644 index 0000000000..f84ea2e3ee --- /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); + + $asset->set_path($path, true); + $this->assertEquals($expected, $asset->get_path()); + } +} |