diff options
author | Marc Alexander <admin@m-a-styles.de> | 2015-10-09 12:14:19 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2015-10-09 12:14:19 +0200 |
commit | 53008c87828746c316019e758641a2a4e37f522b (patch) | |
tree | fe0d7b820eceb0eb6578ce3fb347512d29dabe41 /tests/attachment/manager_test.php | |
parent | 88033feb85f554936462b7652c80a7a815128d2b (diff) | |
download | forums-53008c87828746c316019e758641a2a4e37f522b.tar forums-53008c87828746c316019e758641a2a4e37f522b.tar.gz forums-53008c87828746c316019e758641a2a4e37f522b.tar.bz2 forums-53008c87828746c316019e758641a2a4e37f522b.tar.xz forums-53008c87828746c316019e758641a2a4e37f522b.zip |
[ticket/14168] Fix tabs in manager and add test file
PHPBB3-14168
Diffstat (limited to 'tests/attachment/manager_test.php')
-rw-r--r-- | tests/attachment/manager_test.php | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/tests/attachment/manager_test.php b/tests/attachment/manager_test.php new file mode 100644 index 0000000000..f71ccfbb6c --- /dev/null +++ b/tests/attachment/manager_test.php @@ -0,0 +1,69 @@ +<?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. + * + */ + +class phpbb_attachment_manager_test extends \phpbb_test_case +{ + protected $delete; + protected $resync; + protected $upload; + + public function setUp() + { + $this->delete = $this->getMockBuilder('\phpbb\attachment\delete') + ->disableOriginalConstructor() + ->setMethods(['delete', 'unlink']) + ->getMock(); + $this->resync = $this->getMockBuilder('\phpbb\attachment\resync') + ->disableOriginalConstructor() + ->setMethods(['resync']) + ->getMock(); + $this->upload = $this->getMockBuilder('\phpbb\attachment\upload') + ->disableOriginalConstructor() + ->setMethods(['upload']) + ->getMock(); + } + + protected function get_manager() + { + return new \phpbb\attachment\manager($this->delete, $this->resync, $this->upload); + } + + public function data_delete() + { + return array( + [ + ['foo', [1, 2, 3], false], + ['foo', [1, 2, 3], false], + true, + ], + [ + ['foo', [1, 2, 3], true], + ['foo', [1, 2, 3]], + true, + ], + ); + } + + /** + * @dataProvider data_delete + */ + public function test_delete($input, $input_manager, $output) + { + $mock = $this->delete->expects($this->atLeastOnce()) + ->method('delete'); + $mock = call_user_func_array([$mock, 'with'], $input); + $mock->willReturn($output); + $manager = $this->get_manager(); + $this->assertSame($output, call_user_func_array([$manager, 'delete'], $input_manager)); + } +} |