Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
iMattPro committed Jan 4, 2018
1 parent 1c74943 commit fe0a1d5
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
7 changes: 5 additions & 2 deletions tests/acp/controller_test.php
Expand Up @@ -56,8 +56,11 @@ public function setUp()
$db = $this->new_dbal();
$phpbb_extension_manager = new \phpbb_mock_extension_manager($phpbb_root_path);
$phpbb_dispatcher = new \phpbb_mock_event_dispatcher();
$request = $this->request = $this->getMock('\phpbb\request\request');
$template = $this->template = $this->getMock('\phpbb\template\template');
$request = $this->request = $this->getMockBuilder('\phpbb\request\request')
->disableOriginalConstructor()
->getMock();
$template = $this->template = $this->getMockBuilder('\phpbb\template\template')
->getMock();
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$this->language = new \phpbb\language\language($lang_loader);
$this->user = new \phpbb\user($this->language, '\phpbb\datetime');
Expand Down
3 changes: 2 additions & 1 deletion tests/acp/module_test.php
Expand Up @@ -33,7 +33,8 @@ public function test_module()
->setMethods(array('handle'))
->getMock();

$phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
$phpbb_container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')
->getMock();
$phpbb_container
->expects($this->at(0))
->method('get')
Expand Down
7 changes: 4 additions & 3 deletions tests/core/base.php
Expand Up @@ -68,18 +68,19 @@ public function setUp()
$phpbb_dispatcher = $this->dispatcher = new \phpbb\event\dispatcher(new \phpbb_mock_container_builder());

$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$user = $this->user = $this->getMock('\phpbb\user', array(), array($this->language, '\phpbb\datetime'));
$user = $this->user = $this->getMockBuilder('\phpbb\user')
->setConstructorArgs(array($this->language, '\phpbb\datetime'))
->setMethods(array())
->getMock();
$this->user->expects($this->any())
->method('optionget')
->with($this->anything())
->will($this->returnValueMap(array(array('viewavatars', false, true), array('viewcensors', false, false))));
$this->user->style['style_path'] = 'prosilver';
$this->user->data['user_topic_preview'] = 1;

$this->trim = tools\helper::trimTools()
->setTools($config)
->getTrim();

$this->template = $this->getMockBuilder('\phpbb\template\template')
->getMock();
}
Expand Down
4 changes: 3 additions & 1 deletion tests/core/display_topic_preview_test.php
Expand Up @@ -44,7 +44,9 @@ public function setUp()
->will($this->returnValue(self::$avatar_data));

/** @var \phpbb\request\request|\PHPUnit_Framework_MockObject_MockObject $request */
$request = $this->getMock('\phpbb\request\request');
$request = $this->getMockBuilder('\phpbb\request\request')
->disableOriginalConstructor()
->getMock();

$phpbb_path_helper = new \phpbb\path_helper(
new \phpbb\symfony_request(
Expand Down
8 changes: 5 additions & 3 deletions tests/event/ucp_listener_test.php
Expand Up @@ -27,7 +27,7 @@ class ucp_listener_test extends \phpbb_test_case
/** @var \phpbb\template\template|\PHPUnit_Framework_MockObject_MockObject */
protected $template;

/** @var \phpbb\user|\PHPUnit_Framework_MockObject_MockObject */
/** @var \phpbb\user */
protected $user;

/**
Expand All @@ -41,9 +41,11 @@ public function setUp()

// Load/Mock classes required by the event listener class
$this->config = new \phpbb\config\config(array('topic_preview_limit' => 1));
$this->request = $this->getMock('\phpbb\request\request');
$this->request = $this->getMockBuilder('\phpbb\request\request')
->disableOriginalConstructor()
->getMock();
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->user = $this->getMock('\phpbb\user', array(), array($this->language, '\phpbb\datetime'));
$this->user = new \phpbb\user($this->language, '\phpbb\datetime');
$this->template = $this->getMockBuilder('\phpbb\template\template')
->getMock();
}
Expand Down
3 changes: 2 additions & 1 deletion tests/system/ext_test.php
Expand Up @@ -28,7 +28,8 @@ public function setUp()
parent::setUp();

// Stub the container
$this->container = $this->getMock('\Symfony\Component\DependencyInjection\ContainerInterface');
$this->container = $this->getMockBuilder('\Symfony\Component\DependencyInjection\ContainerInterface')
->getMock();

// Stub the ext finder and disable its constructor
$this->extension_finder = $this->getMockBuilder('\phpbb\finder')
Expand Down

0 comments on commit fe0a1d5

Please sign in to comment.