diff options
author | s9e <s9e.dev@gmail.com> | 2015-02-05 00:01:10 +0100 |
---|---|---|
committer | JoshyPHP <s9e.dev@gmail.com> | 2015-04-02 19:16:01 +0200 |
commit | 90d1a431bde5aaed1e925c3124d081576c759376 (patch) | |
tree | fe85b731c80dd3b26003d1a3c81876c3950c5b88 | |
parent | c4a58bce890869f3d44d145cd43cb036ad99ac74 (diff) | |
download | forums-90d1a431bde5aaed1e925c3124d081576c759376.tar forums-90d1a431bde5aaed1e925c3124d081576c759376.tar.gz forums-90d1a431bde5aaed1e925c3124d081576c759376.tar.bz2 forums-90d1a431bde5aaed1e925c3124d081576c759376.tar.xz forums-90d1a431bde5aaed1e925c3124d081576c759376.zip |
[ticket/11768] Updated tests to use the new constructor signature
PHPBB3-11768
-rw-r--r-- | tests/text_formatter/s9e/parser_test.php | 29 | ||||
-rw-r--r-- | tests/text_formatter/s9e/renderer_test.php | 17 |
2 files changed, 30 insertions, 16 deletions
diff --git a/tests/text_formatter/s9e/parser_test.php b/tests/text_formatter/s9e/parser_test.php index 528305a11c..aee906e213 100644 --- a/tests/text_formatter/s9e/parser_test.php +++ b/tests/text_formatter/s9e/parser_test.php @@ -24,11 +24,16 @@ class phpbb_textformatter_s9e_parser_test extends phpbb_test_case ->with('_foo_parser') ->will($this->returnValue($mock)); + $factory = $this->getMockBuilder('phpbb\\textformatter\\s9e\\factory') + ->disableOriginalConstructor() + ->getMock(); + $factory->expects($this->never())->method('regenerate'); + $parser = new \phpbb\textformatter\s9e\parser( $cache, '_foo_parser', $this->getMockBuilder('phpbb\\user')->disableOriginalConstructor()->getMock(), - new phpbb_mock_container_builder + $factory ); } @@ -46,11 +51,16 @@ class phpbb_textformatter_s9e_parser_test extends phpbb_test_case $cache = new phpbb_mock_cache; $cache->put('_foo_parser', $mock); + $factory = $this->getMockBuilder('phpbb\\textformatter\\s9e\\factory') + ->disableOriginalConstructor() + ->getMock(); + $factory->expects($this->never())->method('regenerate'); + $parser = new \phpbb\textformatter\s9e\parser( $cache, '_foo_parser', $this->getMockBuilder('phpbb\\user')->disableOriginalConstructor()->getMock(), - new phpbb_mock_container_builder + $factory ); $this->assertSame('<t>test</t>', $parser->parse('test')); @@ -67,19 +77,18 @@ class phpbb_textformatter_s9e_parser_test extends phpbb_test_case ->with('test') ->will($this->returnValue('<t>test</t>')); - $factory = $this->getMock('stdClass', array('regenerate')); + $factory = $this->getMockBuilder('phpbb\\textformatter\\s9e\\factory') + ->disableOriginalConstructor() + ->getMock(); $factory->expects($this->once()) ->method('regenerate') ->will($this->returnValue(array($mock, false))); - $container = new phpbb_mock_container_builder; - $container->set('text_formatter.s9e.factory', $factory); - $parser = new \phpbb\textformatter\s9e\parser( new phpbb_mock_cache, '_foo_parser', $this->getMockBuilder('phpbb\\user')->disableOriginalConstructor()->getMock(), - $container + $factory ); $this->assertSame('<t>test</t>', $parser->parse('test')); @@ -104,11 +113,15 @@ class phpbb_textformatter_s9e_parser_test extends phpbb_test_case $cache = new phpbb_mock_cache; $cache->put('_foo_parser', $mock); + $factory = $this->getMockBuilder('phpbb\\textformatter\\s9e\\factory') + ->disableOriginalConstructor() + ->getMock(); + $parser = new \phpbb\textformatter\s9e\parser( $cache, '_foo_parser', $this->getMockBuilder('phpbb\\user')->disableOriginalConstructor()->getMock(), - new phpbb_mock_container_builder + $factory ); call_user_func_array(array($parser, $adapter_method), (array) $adapter_arg); diff --git a/tests/text_formatter/s9e/renderer_test.php b/tests/text_formatter/s9e/renderer_test.php index 76babbfdf3..977c165177 100644 --- a/tests/text_formatter/s9e/renderer_test.php +++ b/tests/text_formatter/s9e/renderer_test.php @@ -33,14 +33,16 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case ->with('_foo_renderer') ->will($this->returnValue(array('class' => 'renderer_foo', 'renderer' => serialize($mock)))); - $container = new phpbb_mock_container_builder; - $container->set('text_formatter.s9e.factory', $factory); + $factory = $this->getMockBuilder('phpbb\\textformatter\\s9e\\factory') + ->disableOriginalConstructor() + ->getMock(); + $factory->expects($this->never())->method('regenerate'); $renderer = new \phpbb\textformatter\s9e\renderer( $cache, $this->get_cache_dir(), '_foo_renderer', - $container + $factory ); } @@ -54,19 +56,18 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case ->with('_foo_renderer') ->will($this->returnValue(false)); - $factory = $this->getMock('stdClass', array('regenerate')); + $factory = $this->getMockBuilder('phpbb\\textformatter\\s9e\\factory') + ->disableOriginalConstructor() + ->getMock(); $factory->expects($this->once()) ->method('regenerate') ->will($this->returnValue(array($mock, false))); - $container = new phpbb_mock_container_builder; - $container->set('text_formatter.s9e.factory', $factory); - $renderer = new \phpbb\textformatter\s9e\renderer( $cache, $this->get_cache_dir(), '_foo_renderer', - $container + $factory ); } |