diff --git a/tests/unit/core/mock/application.php b/tests/unit/core/mock/application.php
index 4154f2a260726..13708246d17f0 100644
--- a/tests/unit/core/mock/application.php
+++ b/tests/unit/core/mock/application.php
@@ -36,17 +36,13 @@ public static function create($test)
'getLanguage'
);
- // Create the mock.
- $mockObject = $test->getMock(
- 'JApplication',
- $methods,
- // Constructor arguments.
- array(),
- // Mock class name.
- '',
- // Call original constructor.
- false
- );
+ // Build the mock object.
+ $mockObject = $test->getMockBuilder('JApplication')
+ ->setMethods($methods)
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
$menu = TestMockMenu::create($test);
$mockObject->expects($test->any())
diff --git a/tests/unit/core/mock/application/base.php b/tests/unit/core/mock/application/base.php
index 1c1960b1446b0..8fc61d022b41c 100644
--- a/tests/unit/core/mock/application/base.php
+++ b/tests/unit/core/mock/application/base.php
@@ -75,17 +75,12 @@ public static function create($test, $options = array())
// Collect all the relevant methods in JApplicationBase.
$methods = self::getMethods();
- // Create the mock.
- $mockObject = $test->getMock(
- 'JApplicationBase',
- $methods,
- // Constructor arguments.
- array(),
- // Mock class name.
- '',
- // Call original constructor.
- true
- );
+ // Build the mock object & allow Call to original constructor
+ $mockObject = $test->getMockBuilder('JApplicationBase')
+ ->setMethods($methods)
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->getMock();
$mockObject = self::addBehaviours($test, $mockObject, $options);
diff --git a/tests/unit/core/mock/application/cli.php b/tests/unit/core/mock/application/cli.php
index 7facfaba69580..bd0719cdf3c17 100644
--- a/tests/unit/core/mock/application/cli.php
+++ b/tests/unit/core/mock/application/cli.php
@@ -51,17 +51,12 @@ public static function create($test, $options = array())
// Collect all the relevant methods in JApplicationCli.
$methods = self::getMethods();
- // Create the mock.
- $mockObject = $test->getMock(
- 'JApplicationCli',
- $methods,
- // Constructor arguments.
- array(),
- // Mock class name.
- '',
- // Call original constructor.
- true
- );
+ // Build the mock object & allow Call to original constructor.
+ $mockObject = $test->getMockBuilder('JApplicationCli')
+ ->setMethods($methods)
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->getMock();
$mockObject = self::addBehaviours($test, $mockObject, $options);
diff --git a/tests/unit/core/mock/application/cms.php b/tests/unit/core/mock/application/cms.php
index 33b6e9096e5b3..3c3937e335685 100644
--- a/tests/unit/core/mock/application/cms.php
+++ b/tests/unit/core/mock/application/cms.php
@@ -33,7 +33,8 @@ public static function getMethods()
'isAdmin',
'isSite',
'getUserState',
- 'getUserStateFromRequest'
+ 'getUserStateFromRequest',
+ 'setUserState',
);
return array_merge($methods, parent::getMethods());
@@ -88,17 +89,14 @@ public static function create($test, $options = array(), $constructor = array())
$methods = self::getMethods();
if (isset($options))
- // Create the mock.
- $mockObject = $test->getMock(
- 'JApplicationCms',
- $methods,
- // Constructor arguments.
- $constructor,
- // Mock class name.
- '',
- // Call original constructor.
- true
- );
+ {
+ // Build the mock object & allow call to original constructor.
+ $mockObject = $test->getMockBuilder('JApplicationCms')
+ ->setMethods($methods)
+ ->setConstructorArgs($constructor)
+ ->setMockClassName('')
+ ->getMock();
+ }
$mockObject = self::addBehaviours($test, $mockObject, $options);
diff --git a/tests/unit/core/mock/application/web.php b/tests/unit/core/mock/application/web.php
index ed6bdea213521..2e126acc9633e 100644
--- a/tests/unit/core/mock/application/web.php
+++ b/tests/unit/core/mock/application/web.php
@@ -161,17 +161,12 @@ public static function create($test, $options = array())
// Collect all the relevant methods in JApplicationWeb (work in progress).
$methods = self::getMethods();
- // Create the mock.
- $mockObject = $test->getMock(
- 'JApplicationWeb',
- $methods,
- // Constructor arguments.
- array(),
- // Mock class name.
- '',
- // Call original constructor.
- true
- );
+ // Build the mock object & allow call to original constructor.
+ $mockObject = $test->getMockBuilder('JApplicationWeb')
+ ->setMethods($methods)
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->getMock();
$mockObject = self::addBehaviours($test, $mockObject, $options);
diff --git a/tests/unit/core/mock/cache.php b/tests/unit/core/mock/cache.php
index 6e86393293bd6..f9b94cf13d67a 100644
--- a/tests/unit/core/mock/cache.php
+++ b/tests/unit/core/mock/cache.php
@@ -42,17 +42,13 @@ public static function create(TestCase $test, $data = array())
'store',
);
- // Create the mock.
- $mockObject = $test->getMock(
- 'JCache',
- $methods,
- // Constructor arguments.
- array(),
- // Mock class name.
- '',
- // Call original constructor.
- false
- );
+ // Build the mock object.
+ $mockObject = $test->getMockBuilder('JCache')
+ ->setMethods($methods)
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
$test->assignMockCallbacks(
$mockObject,
diff --git a/tests/unit/core/mock/config.php b/tests/unit/core/mock/config.php
index 3558078473caa..057f065ea38ee 100644
--- a/tests/unit/core/mock/config.php
+++ b/tests/unit/core/mock/config.php
@@ -31,17 +31,13 @@ public static function create($test)
'set'
);
- // Create the mock.
- $mockObject = $test->getMock(
- 'JConfig',
- $methods,
- // Constructor arguments.
- array(),
- // Mock class name.
- '',
- // Call original constructor.
- false
- );
+ // Build the mock object.
+ $mockObject = $test->getMockBuilder('JConfig')
+ ->setMethods($methods)
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
return $mockObject;
}
diff --git a/tests/unit/core/mock/controller.php b/tests/unit/core/mock/controller.php
index 45d281b487894..a2bb3e7e59e33 100644
--- a/tests/unit/core/mock/controller.php
+++ b/tests/unit/core/mock/controller.php
@@ -34,17 +34,13 @@ public static function create($test)
'unserialize',
);
- // Create the mock.
- $mockObject = $test->getMock(
- 'JControllerBase',
- $methods,
- // Constructor arguments.
- array(),
- // Mock class name.
- '',
- // Call original constructor.
- false
- );
+ // Build the mock object.
+ $mockObject = $test->getMockBuilder('JControllerBase')
+ ->setMethods($methods)
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
// TODO Mock the input.
TestReflection::setValue($mockObject, 'input', new JInput);
diff --git a/tests/unit/core/mock/database/driver.php b/tests/unit/core/mock/database/driver.php
index 15401d2aa689f..424c5e2dff7ca 100644
--- a/tests/unit/core/mock/database/driver.php
+++ b/tests/unit/core/mock/database/driver.php
@@ -97,17 +97,13 @@ public static function create($test, $driver = '', array $extraMethods = array()
'updateObject',
));
- // Create the mock.
- $mockObject = $test->getMock(
- 'JDatabaseDriver' . $driver,
- $methods,
- // Constructor arguments.
- array(),
- // Mock class name.
- '',
- // Call original constructor.
- false
- );
+ // Build the mock object.
+ $mockObject = $test->getMockBuilder('JDatabaseDriver' . $driver)
+ ->setMethods($methods)
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
// Mock selected methods.
$test->assignMockReturns(
diff --git a/tests/unit/core/mock/dispatcher.php b/tests/unit/core/mock/dispatcher.php
index cb1c0f7e2fcad..92a479f644680 100644
--- a/tests/unit/core/mock/dispatcher.php
+++ b/tests/unit/core/mock/dispatcher.php
@@ -53,18 +53,13 @@ public static function create($test, $defaults = true)
'test',
);
- // Create the mock.
- $mockObject = $test->getMock(
- 'JEventDispatcher',
- $methods,
- // Constructor arguments.
- array(),
- // Mock class name.
- '',
- // Call original constructor.
- false
- );
-
+ // Build the mock object.
+ $mockObject = $test->getMockBuilder('JEventDispatcher')
+ ->setMethods($methods)
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
// Mock selected methods.
$test->assignMockReturns(
$mockObject, array(
diff --git a/tests/unit/core/mock/document.php b/tests/unit/core/mock/document.php
index e61df25ba5706..80e937be3fffc 100644
--- a/tests/unit/core/mock/document.php
+++ b/tests/unit/core/mock/document.php
@@ -33,16 +33,12 @@ public static function create($test)
);
// Create the mock.
- $mockObject = $test->getMock(
- 'JDocument',
- $methods,
- // Constructor arguments.
- array(),
- // Mock class name.
- '',
- // Call original constructor.
- false
- );
+ $mockObject = $test->getMockBuilder('JDocument')
+ ->setMethods($methods)
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
// Mock selected methods.
$test->assignMockReturns(
diff --git a/tests/unit/core/mock/input.php b/tests/unit/core/mock/input.php
index 333dc4413b6e4..0aa15866896bd 100644
--- a/tests/unit/core/mock/input.php
+++ b/tests/unit/core/mock/input.php
@@ -72,17 +72,13 @@ public function createInput(array $options = null)
$methods = array_merge($methods, $options['methods']);
}
- // Create the mock.
- $mockObject = self::$test->getMock(
- 'JInput',
- $methods,
- // Constructor arguments.
- array(),
- // Mock class name.
- '',
- // Call original constructor.
- false
- );
+ // Build the mock object.
+ $mockObject = self::$test->getMockBuilder('JInput')
+ ->setMethods($methods)
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
self::$test->assignMockCallbacks(
$mockObject,
diff --git a/tests/unit/core/mock/language.php b/tests/unit/core/mock/language.php
index 0bd075a23151c..4aab789ff82cb 100644
--- a/tests/unit/core/mock/language.php
+++ b/tests/unit/core/mock/language.php
@@ -33,17 +33,13 @@ public static function create($test)
'test',
);
- // Create the mock.
- $mockObject = $test->getMock(
- 'JLanguage',
- $methods,
- // Constructor arguments.
- array(),
- // Mock class name.
- '',
- // Call original constructor.
- false
- );
+ // Build the mock object.
+ $mockObject = $test->getMockBuilder('JLanguage')
+ ->setMethods($methods)
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
// Mock selected methods.
$test->assignMockReturns(
diff --git a/tests/unit/core/mock/menu.php b/tests/unit/core/mock/menu.php
index 09836a2a6efcf..a1faf3504e388 100644
--- a/tests/unit/core/mock/menu.php
+++ b/tests/unit/core/mock/menu.php
@@ -41,17 +41,13 @@ public static function create(PHPUnit_Framework_TestCase $test, $setDefault = tr
'load'
);
- // Create the mock.
- $mockObject = $test->getMock(
- 'JMenu',
- $methods,
- // Constructor arguments.
- array(),
- // Mock class name.
- '',
- // Call original constructor.
- false
- );
+ // Build the mock object.
+ $mockObject = $test->getMockBuilder('JMenu')
+ ->setMethods($methods)
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
self::createMenuSampleData();
diff --git a/tests/unit/core/mock/rules.php b/tests/unit/core/mock/rules.php
index d4618d0538cde..fcaf7db846fe5 100644
--- a/tests/unit/core/mock/rules.php
+++ b/tests/unit/core/mock/rules.php
@@ -30,17 +30,13 @@ public static function create($test)
'allow',
);
- // Create the mock.
- $mockObject = $test->getMock(
- 'JAccessRules',
- $methods,
- // Constructor arguments.
- array(),
- // Mock class name.
- '',
- // Call original constructor.
- false
- );
+ // Build the mock object.
+ $mockObject = $test->getMockBuilder('JAccessRules')
+ ->setMethods($methods)
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
$test->assignMockCallbacks(
$mockObject,
diff --git a/tests/unit/core/mock/session.php b/tests/unit/core/mock/session.php
index 62314648538ee..0dbecf9154581 100644
--- a/tests/unit/core/mock/session.php
+++ b/tests/unit/core/mock/session.php
@@ -81,17 +81,13 @@ public static function create($test, $options = array())
'set',
);
- // Create the mock.
- $mockObject = $test->getMock(
- 'JSession',
- $methods,
- // Constructor arguments.
- array(),
- // Mock class name.
- '',
- // Call original constructor.
- false
- );
+ // Build the mock object.
+ $mockObject = $test->getMockBuilder('JSession')
+ ->setMethods($methods)
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
// Mock selected methods.
$test->assignMockReturns(
diff --git a/tests/unit/suites/administrator/includes/JAdministratorHelperTest.php b/tests/unit/suites/administrator/includes/JAdministratorHelperTest.php
index d360c0c3ed5ab..557546b3a46f4 100644
--- a/tests/unit/suites/administrator/includes/JAdministratorHelperTest.php
+++ b/tests/unit/suites/administrator/includes/JAdministratorHelperTest.php
@@ -34,7 +34,7 @@ protected function setUp()
JFactory::$application = $this->getMockCmsApp();
JFactory::$application->input = $this->getMockInput();
- $this->user = $this->getMock('JUser', array('get', 'authorise'));
+ $this->user = $this->getMockBuilder('JUser')->setMethods(array('get', 'authorise'))->getMock();
JFactory::$application->expects($this->once())
->method('getIdentity')
diff --git a/tests/unit/suites/database/driver/mysql/JDatabaseImporterMysqlTest.php b/tests/unit/suites/database/driver/mysql/JDatabaseImporterMysqlTest.php
index a261b93805606..4a0c3297efc3a 100644
--- a/tests/unit/suites/database/driver/mysql/JDatabaseImporterMysqlTest.php
+++ b/tests/unit/suites/database/driver/mysql/JDatabaseImporterMysqlTest.php
@@ -60,22 +60,21 @@ public static function setUpBeforeClass()
*/
protected function setUp()
{
- $this->dbo = $this->getMock(
- 'JDatabaseDriverMysql',
- array(
- 'getErrorNum',
- 'getPrefix',
- 'getTableColumns',
- 'getTableKeys',
- 'quoteName',
- 'loadObjectList',
- 'quote',
- 'setQuery',
- ),
- array(),
- '',
- false
- );
+ $this->dbo = $this->getMockBuilder('JDatabaseDriverMysql')
+ ->setMethods(array(
+ 'getErrorNum',
+ 'getPrefix',
+ 'getTableColumns',
+ 'getTableKeys',
+ 'quoteName',
+ 'loadObjectList',
+ 'quote',
+ 'setQuery',
+ ))
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
$this->dbo
->expects($this->any())
diff --git a/tests/unit/suites/database/driver/mysqli/JDatabaseImporterMysqliTest.php b/tests/unit/suites/database/driver/mysqli/JDatabaseImporterMysqliTest.php
index b8d537664cc4c..64680b0200b03 100644
--- a/tests/unit/suites/database/driver/mysqli/JDatabaseImporterMysqliTest.php
+++ b/tests/unit/suites/database/driver/mysqli/JDatabaseImporterMysqliTest.php
@@ -46,22 +46,21 @@ class JDatabaseImporterMysqliTest extends PHPUnit_Framework_TestCase
*/
public function setup()
{
- $this->dbo = $this->getMock(
- 'JDatabaseDriverMysqli',
- array(
- 'getErrorNum',
- 'getPrefix',
- 'getTableColumns',
- 'getTableKeys',
- 'quoteName',
- 'loadObjectList',
- 'quote',
- 'setQuery',
- ),
- array(),
- '',
- false
- );
+ $this->dbo = $this->getMockBuilder('JDatabaseDriverMysqli')
+ ->setMethods(array(
+ 'getErrorNum',
+ 'getPrefix',
+ 'getTableColumns',
+ 'getTableKeys',
+ 'quoteName',
+ 'loadObjectList',
+ 'quote',
+ 'setQuery',
+ ))
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
$this->dbo->expects(
$this->any()
diff --git a/tests/unit/suites/database/driver/pdomysql/JDatabaseExporterPdomysqlTest.php b/tests/unit/suites/database/driver/pdomysql/JDatabaseExporterPdomysqlTest.php
index 6dc79aa3f5f77..87d79d3de0562 100644
--- a/tests/unit/suites/database/driver/pdomysql/JDatabaseExporterPdomysqlTest.php
+++ b/tests/unit/suites/database/driver/pdomysql/JDatabaseExporterPdomysqlTest.php
@@ -34,21 +34,20 @@ public function setup()
parent::setUp();
// Set up the database object mock.
- $this->dbo = $this->getMock(
- 'JDatabaseDriverPdomysql',
- array(
- 'getErrorNum',
- 'getPrefix',
- 'getTableColumns',
- 'getTableKeys',
- 'quoteName',
- 'loadObjectList',
- 'setQuery',
- ),
- array(),
- '',
- false
- );
+ $this->dbo = $this->getMockBuilder('JDatabaseDriverPdomysql')
+ ->setMethods(array(
+ 'getErrorNum',
+ 'getPrefix',
+ 'getTableColumns',
+ 'getTableKeys',
+ 'quoteName',
+ 'loadObjectList',
+ 'setQuery',
+ ))
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
$this->dbo->expects(
$this->any()
diff --git a/tests/unit/suites/database/driver/pdomysql/JDatabaseImporterPdomysqlTest.php b/tests/unit/suites/database/driver/pdomysql/JDatabaseImporterPdomysqlTest.php
index 11fcb698e5f2e..c1dd1537d3da1 100644
--- a/tests/unit/suites/database/driver/pdomysql/JDatabaseImporterPdomysqlTest.php
+++ b/tests/unit/suites/database/driver/pdomysql/JDatabaseImporterPdomysqlTest.php
@@ -55,22 +55,21 @@ public function setup()
parent::setUp();
// Set up the database object mock.
- $this->dbo = $this->getMock(
- 'JDatabaseDriverPdomysql',
- array(
- 'getErrorNum',
- 'getPrefix',
- 'getTableColumns',
- 'getTableKeys',
- 'quoteName',
- 'loadObjectList',
- 'quote',
- 'setQuery',
- ),
- array(),
- '',
- false
- );
+ $this->dbo = $this->getMockBuilder('JDatabaseDriverPdomysql')
+ ->setMethods(array(
+ 'getErrorNum',
+ 'getPrefix',
+ 'getTableColumns',
+ 'getTableKeys',
+ 'quoteName',
+ 'loadObjectList',
+ 'quote',
+ 'setQuery',
+ ))
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
$this->dbo->expects(
$this->any()
diff --git a/tests/unit/suites/database/driver/postgresql/JDatabaseImporterPostgresqlTest.php b/tests/unit/suites/database/driver/postgresql/JDatabaseImporterPostgresqlTest.php
index 3e67ac3ae3491..b66cd5fc7abbc 100644
--- a/tests/unit/suites/database/driver/postgresql/JDatabaseImporterPostgresqlTest.php
+++ b/tests/unit/suites/database/driver/postgresql/JDatabaseImporterPostgresqlTest.php
@@ -31,28 +31,27 @@ class JDatabaseImporterPostgresqlTest extends PHPUnit_Framework_TestCase
public function setup()
{
// Set up the database object mock.
- $this->dbo = $this->getMock(
- 'JDatabaseDriverPostgresql',
- array(
- 'getErrorNum',
- 'getPrefix',
- 'getTableColumns',
- 'getTableKeys',
- 'getTableSequences',
- 'getAddSequenceSQL',
- 'getChangeSequenceSQL',
- 'getDropSequenceSQL',
- 'getAddIndexSQL',
- 'getVersion',
- 'quoteName',
- 'loadObjectList',
- 'quote',
- 'setQuery',
- ),
- array(),
- '',
- false
- );
+ $this->dbo = $this->getMockBuilder('JDatabaseDriverPostgresql')
+ ->setMethods(array(
+ 'getErrorNum',
+ 'getPrefix',
+ 'getTableColumns',
+ 'getTableKeys',
+ 'getTableSequences',
+ 'getAddSequenceSQL',
+ 'getChangeSequenceSQL',
+ 'getDropSequenceSQL',
+ 'getAddIndexSQL',
+ 'getVersion',
+ 'quoteName',
+ 'loadObjectList',
+ 'quote',
+ 'setQuery',
+ ))
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
$this->dbo->expects(
$this->any()
diff --git a/tests/unit/suites/libraries/cms/application/JApplicationCmsTest.php b/tests/unit/suites/libraries/cms/application/JApplicationCmsTest.php
index 53fe522b096c8..b3785cffe6ce3 100644
--- a/tests/unit/suites/libraries/cms/application/JApplicationCmsTest.php
+++ b/tests/unit/suites/libraries/cms/application/JApplicationCmsTest.php
@@ -188,7 +188,13 @@ public function test__constructDependancyInjection()
$config = new Registry;
$config->set('session', false);
- $mockClient = $this->getMock('JApplicationWebClient', array('test'), array(), '', false);
+ // Build the mock object.
+ $mockClient = $this->getMockBuilder('JApplicationWebClient')
+ ->setMethods(array('test'))
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
$inspector = new JApplicationCmsInspector($mockInput, $config, $mockClient);
diff --git a/tests/unit/suites/libraries/cms/html/JHtmlTest.php b/tests/unit/suites/libraries/cms/html/JHtmlTest.php
index 7f9267ecb1b75..9bc5e50cf29a5 100644
--- a/tests/unit/suites/libraries/cms/html/JHtmlTest.php
+++ b/tests/unit/suites/libraries/cms/html/JHtmlTest.php
@@ -176,7 +176,10 @@ public function test_WithMissingMethod()
*/
public function testRegister()
{
- $registered = $this->getMock('MyHtmlClass', array('mockFunction'));
+ // Build the mock object.
+ $registered = $this->getMockBuilder('MyHtmlClass')
+ ->setMethods(array('mockFunction'))
+ ->getMock();
// Test that we can register the method
$this->assertTrue(
@@ -205,8 +208,10 @@ public function testRegister()
*/
public function testUnregister()
{
- // Register a method so we can unregister it
- $registered = $this->getMock('MyHtmlClass', array('mockFunction'));
+ // Build the mock object to Register a method so we can unregister it.
+ $registered = $this->getMockBuilder('MyHtmlClass')
+ ->setMethods(array('mockFunction'))
+ ->getMock();
JHtml::register('prefix.unregister.testfunction', array($registered, 'mockFunction'));
@@ -230,7 +235,10 @@ public function testUnregister()
*/
public function testIsRegistered()
{
- $registered = $this->getMock('MyHtmlClass', array('mockFunction'));
+ // Build the mock object.
+ $registered = $this->getMockBuilder('MyHtmlClass')
+ ->setMethods(array('mockFunction'))
+ ->getMock();
// Test that we can register the method.
JHtml::register('prefix.isregistered.method', array($registered, 'mockFunction'));
diff --git a/tests/unit/suites/libraries/cms/installer/JInstallerAdapterTest.php b/tests/unit/suites/libraries/cms/installer/JInstallerAdapterTest.php
index bdc048e96627a..26d52e326e835 100644
--- a/tests/unit/suites/libraries/cms/installer/JInstallerAdapterTest.php
+++ b/tests/unit/suites/libraries/cms/installer/JInstallerAdapterTest.php
@@ -64,7 +64,7 @@ protected function tearDown()
*/
public function testConstructor()
{
- $mockInstaller = $this->getMock('JInstaller');
+ $mockInstaller = $this->getMockBuilder('JInstaller')->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass('JInstallerAdapter', array($mockInstaller, $mockDatabase, array('foo' => 'bar')));
@@ -87,12 +87,15 @@ public function testConstructor()
*/
public function testCheckExistingExtensionForExistingExtension()
{
- $mockInstaller = $this->getMock('JInstaller');
+ $mockInstaller = $this->getMockBuilder('JInstaller')->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass('JInstallerAdapter', array($mockInstaller, $mockDatabase));
// Set up a mock JTableExtension
- $mockTableExtension = $this->getMock('JTableExtension', array('find', 'load'), array($this->getMockDatabase()));
+ $mockTableExtension = $this->getMockBuilder('JTableExtension')
+ ->setMethods(array('find', 'load'))
+ ->setConstructorArgs(array(self::$driver))
+ ->getMock();
// A set of data for an extension
$type = 'plugin';
@@ -132,12 +135,15 @@ public function testCheckExistingExtensionForExistingExtension()
*/
public function testCheckExistingExtensionForExtensionThatDoesNotExist()
{
- $mockInstaller = $this->getMock('JInstaller');
+ $mockInstaller = $this->getMockBuilder('JInstaller')->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass('JInstallerAdapter', array($mockInstaller, $mockDatabase));
// Set up a mock JTableExtension
- $mockTableExtension = $this->getMock('JTableExtension', array('find', 'load'), array($this->getMockDatabase()));
+ $mockTableExtension = $this->getMockBuilder('JTableExtension')
+ ->setMethods(array('find', 'load'))
+ ->setConstructorArgs(array($this->getMockDatabase()))
+ ->getMock();
// A set of data for an extension
$type = 'plugin';
@@ -175,12 +181,15 @@ public function testCheckExistingExtensionForExtensionThatDoesNotExist()
*/
public function testCheckExistingExtensionReturnsErrorWhenTableGivesException()
{
- $mockInstaller = $this->getMock('JInstaller');
+ $mockInstaller = $this->getMockBuilder('JInstaller')->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass('JInstallerAdapter', array($mockInstaller, $mockDatabase));
// Set up a mock JTableExtension
- $mockTableExtension = $this->getMock('JTableExtension', array('find'), array($this->getMockDatabase()));
+ $mockTableExtension = $this->getMockBuilder('JTableExtension')
+ ->setMethods(array('find', 'load'))
+ ->setConstructorArgs(array($this->getMockDatabase()))
+ ->getMock();
$type = 'plugin';
$element = 'plg_finder_content';
@@ -205,7 +214,10 @@ public function testCheckExistingExtensionReturnsErrorWhenTableGivesException()
*/
public function testCheckExtensionInFilesystem()
{
- $mockInstaller = $this->getMock('JInstaller', array('getPath', 'isOverwrite', 'isUpgrade', 'setOverwrite', 'setUpgrade'));
+ $mockInstaller = $this->getMockBuilder('JInstaller')
+ ->setMethods(array('getPath', 'isOverwrite', 'isUpgrade', 'setOverwrite', 'setUpgrade'))
+ ->getMock();
+
$mockInstaller->expects($this->once())
->method('getPath')
->with('extension_root')
@@ -261,7 +273,10 @@ public function testCheckExtensionInFilesystem()
*/
public function testsCheckExtensionInFilesystemInstallerRouteSetWhenFilesystemExistsWithExtensionIdSet()
{
- $mockInstaller = $this->getMock('JInstaller', array('getPath', 'isOverwrite', 'isUpgrade', 'setOverwrite', 'setUpgrade'));
+ $mockInstaller = $this->getMockBuilder('JInstaller')
+ ->setMethods(array('getPath', 'isOverwrite', 'isUpgrade', 'setOverwrite', 'setUpgrade'))
+ ->getMock();
+
$mockInstaller->expects($this->once())
->method('getPath')
->with('extension_root')
@@ -301,7 +316,10 @@ public function testsCheckExtensionInFilesystemInstallerRouteSetWhenFilesystemEx
*/
public function testsCheckExtensionInFilesystemWithOverwriteSetFalse()
{
- $mockInstaller = $this->getMock('JInstaller', array('getPath', 'isOverwrite', 'isUpgrade'));
+ $mockInstaller = $this->getMockBuilder('JInstaller')
+ ->setMethods(array('getPath', 'isOverwrite', 'isUpgrade'))
+ ->getMock();
+
$mockInstaller->expects($this->any())
->method('getPath')
->with('extension_root')
@@ -333,7 +351,9 @@ public function testsCheckExtensionInFilesystemWithOverwriteSetFalse()
*/
public function testDiscoverInstall()
{
- $mockInstaller = $this->getMock('JInstaller', array('abort'));
+ $mockInstaller = $this->getMockBuilder('JInstaller')
+ ->setMethods(array('abort'))
+ ->getMock();
// For this test we to ensure abort is not called in JInstaller
$mockInstaller->expects($this->never())
@@ -360,7 +380,11 @@ public function testDiscoverInstall()
);
// Set up a mock JTableExtension
- $mockTableExtension = $this->getMock('JTableExtension', array('find', 'load'), array($this->getMockDatabase()));
+ $mockTableExtension = $this->getMockBuilder('JTableExtension')
+ ->setMethods(array('find', 'load'))
+ ->setConstructorArgs(array($this->getMockDatabase()))
+ ->getMock();
+
$mockTableExtension->extension_id = 444;
TestReflection::setValue($object, 'extension', $mockTableExtension);
@@ -401,7 +425,9 @@ public function testDiscoverInstall()
*/
public function testDiscoverInstallWithNoDescription()
{
- $mockInstaller = $this->getMock('JInstaller', array('abort'));
+ $mockInstaller = $this->getMockBuilder('JInstaller')
+ ->setMethods(array('abort'))
+ ->getMock();
// For this test we to ensure abort is not called in JInstaller
$mockInstaller->expects($this->never())
@@ -428,7 +454,10 @@ public function testDiscoverInstallWithNoDescription()
);
// Set up a mock JTableExtension
- $mockTableExtension = $this->getMock('JTableExtension', array('find', 'load'), array($this->getMockDatabase()));
+ $mockTableExtension = $this->getMockBuilder('JTableExtension')
+ ->setMethods(array('find', 'load'))
+ ->setConstructorArgs(array($this->getMockDatabase()))
+ ->getMock();
$mockTableExtension->extension_id = 444;
TestReflection::setValue($object, 'extension', $mockTableExtension);
@@ -488,7 +517,9 @@ public function casesTestExceptionThrownInDiscoverInstall()
*/
public function testDiscoverInstallWithExceptionThrownInAdapterMethods($method)
{
- $mockInstaller = $this->getMock('JInstaller', array('abort'));
+ $mockInstaller = $this->getMockBuilder('JInstaller')
+ ->setMethods(array('abort'))
+ ->getMock();
// For this test we to ensure abort is not called in JInstaller
$mockInstaller->expects($this->once())
@@ -544,7 +575,7 @@ public function testDiscoverInstallWithExceptionThrownInAdapterMethods($method)
*/
public function testDefaultGetDiscoverInstallSupported()
{
- $mockInstaller = $this->getMock('JInstaller');
+ $mockInstaller = $this->getMockBuilder('JInstaller')->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass('JInstallerAdapter', array($mockInstaller, $mockDatabase));
@@ -561,7 +592,7 @@ public function testDefaultGetDiscoverInstallSupported()
*/
public function testGetDiscoverInstallSupported()
{
- $mockInstaller = $this->getMock('JInstaller');
+ $mockInstaller = $this->getMockBuilder('JInstaller')->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass('JInstallerAdapter', array($mockInstaller, $mockDatabase));
@@ -581,7 +612,7 @@ public function testGetDiscoverInstallSupported()
public function testGetElementWithElementInManifest()
{
// Create the test object
- $mockInstaller = $this->getMock('JInstaller');
+ $mockInstaller = $this->getMockBuilder('JInstaller')->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass('JInstallerAdapter', array($mockInstaller, $mockDatabase));
@@ -604,7 +635,7 @@ public function testGetElementWithElementInManifest()
public function testGetElementWithInjectedElement()
{
// Create the test object
- $mockInstaller = $this->getMock('JInstaller');
+ $mockInstaller = $this->getMockBuilder('JInstaller')->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass('JInstallerAdapter', array($mockInstaller, $mockDatabase));
@@ -623,7 +654,7 @@ public function testGetElementWithInjectedElement()
public function testGetElementWithElementFromName()
{
// Create the test object
- $mockInstaller = $this->getMock('JInstaller');
+ $mockInstaller = $this->getMockBuilder('JInstaller')->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass(
'JInstallerAdapter',
@@ -657,7 +688,7 @@ public function testGetElementWithElementFromName()
*/
public function testGetManifest()
{
- $mockInstaller = $this->getMock('JInstaller');
+ $mockInstaller = $this->getMockBuilder('JInstaller')->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass('JInstallerAdapter', array($mockInstaller, $mockDatabase));
$manifestObject = simplexml_load_string($this->sampleManifest);
@@ -679,7 +710,7 @@ public function testGetManifest()
public function testGetName()
{
// Create the test object
- $mockInstaller = $this->getMock('JInstaller');
+ $mockInstaller = $this->getMockBuilder('JInstaller')->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass('JInstallerAdapter', array($mockInstaller, $mockDatabase));
@@ -700,7 +731,7 @@ public function testGetName()
*/
public function testGetDefaultRoute()
{
- $mockInstaller = $this->getMock('JInstaller');
+ $mockInstaller = $this->getMockBuilder('JInstaller')->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass('JInstallerAdapter', array($mockInstaller, $mockDatabase));
@@ -718,7 +749,7 @@ public function testGetDefaultRoute()
*/
public function testGetRouteForSetObject()
{
- $mockInstaller = $this->getMock('JInstaller');
+ $mockInstaller = $this->getMockBuilder('JInstaller')->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass('JInstallerAdapter', array($mockInstaller, $mockDatabase));
@@ -764,7 +795,7 @@ public function casesGetScriptClassName()
*/
public function testGetScriptClassName($element, $expected, $failureMessage)
{
- $mockInstaller = $this->getMock('JInstaller');
+ $mockInstaller = $this->getMockBuilder('JInstaller')->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass('JInstallerAdapter', array($mockInstaller, $mockDatabase));
@@ -784,7 +815,9 @@ public function testGetScriptClassName($element, $expected, $failureMessage)
*/
public function testInstall()
{
- $mockInstaller = $this->getMock('JInstaller', array('abort'));
+ $mockInstaller = $this->getMockBuilder('JInstaller')
+ ->setMethods(array('abort'))
+ ->getMock();
// For this test we to ensure abort is not called in JInstaller
$mockInstaller->expects($this->never())
@@ -816,7 +849,10 @@ public function testInstall()
);
// Set up a mock JTableExtension
- $mockTableExtension = $this->getMock('JTableExtension', array('find', 'load'), array($this->getMockDatabase()));
+ $mockTableExtension = $this->getMockBuilder('JTableExtension')
+ ->setMethods(array('find', 'load'))
+ ->setConstructorArgs(array($this->getMockDatabase()))
+ ->getMock();
$mockTableExtension->extension_id = 444;
TestReflection::setValue($object, 'extension', $mockTableExtension);
@@ -857,7 +893,9 @@ public function testInstall()
*/
public function testInstallOnUpdateRoute()
{
- $mockInstaller = $this->getMock('JInstaller', array('abort'));
+ $mockInstaller = $this->getMockBuilder('JInstaller')
+ ->setMethods(array('abort'))
+ ->getMock();
// For this test we to ensure abort is not called in JInstaller
$mockInstaller->expects($this->never())
@@ -890,7 +928,10 @@ public function testInstallOnUpdateRoute()
);
// Set up a mock JTableExtension
- $mockTableExtension = $this->getMock('JTableExtension', array('find', 'load'), array($this->getMockDatabase()));
+ $mockTableExtension = $this->getMockBuilder('JTableExtension')
+ ->setMethods(array('find', 'load'))
+ ->setConstructorArgs(array($this->getMockDatabase()))
+ ->getMock();
$mockTableExtension->extension_id = 444;
TestReflection::setValue($object, 'extension', $mockTableExtension);
TestReflection::setValue($object, 'route', 'update');
@@ -936,7 +977,9 @@ public function testInstallOnUpdateRoute()
*/
public function testInstallAbortsWhenSetupUpdatesThrowsException()
{
- $mockInstaller = $this->getMock('JInstaller', array('abort'));
+ $mockInstaller = $this->getMockBuilder('JInstaller')
+ ->setMethods(array('abort'))
+ ->getMock();
// For this test we to ensure abort is not called in JInstaller
$mockInstaller->expects($this->once())
@@ -969,7 +1012,10 @@ public function testInstallAbortsWhenSetupUpdatesThrowsException()
);
// Set up a mock JTableExtension
- $mockTableExtension = $this->getMock('JTableExtension', array('find', 'load'), array($this->getMockDatabase()));
+ $mockTableExtension = $this->getMockBuilder('JTableExtension')
+ ->setMethods(array('find', 'load'))
+ ->setConstructorArgs(array($this->getMockDatabase()))
+ ->getMock();
$mockTableExtension->extension_id = 444;
TestReflection::setValue($object, 'extension', $mockTableExtension);
TestReflection::setValue($object, 'route', 'update');
@@ -1009,7 +1055,9 @@ public function testInstallAbortsWhenSetupUpdatesThrowsException()
*/
public function testInstallWithNoDescription()
{
- $mockInstaller = $this->getMock('JInstaller', array('abort'));
+ $mockInstaller = $this->getMockBuilder('JInstaller')
+ ->setMethods(array('abort'))
+ ->getMock();
// For this test we to ensure abort is not called in JInstaller
$mockInstaller->expects($this->never())
@@ -1041,7 +1089,10 @@ public function testInstallWithNoDescription()
);
// Set up a mock JTableExtension
- $mockTableExtension = $this->getMock('JTableExtension', array('find', 'load'), array($this->getMockDatabase()));
+ $mockTableExtension = $this->getMockBuilder('JTableExtension')
+ ->setMethods(array('find', 'load'))
+ ->setConstructorArgs(array($this->getMockDatabase()))
+ ->getMock();
$mockTableExtension->extension_id = 444;
TestReflection::setValue($object, 'extension', $mockTableExtension);
@@ -1105,7 +1156,9 @@ public function casesTestExceptionThrownInInstall()
*/
public function testInstallWithExceptionThrownInAdapterMethods($method)
{
- $mockInstaller = $this->getMock('JInstaller', array('abort'));
+ $mockInstaller = $this->getMockBuilder('JInstaller')
+ ->setMethods(array('abort'))
+ ->getMock();
// For this test we to ensure abort is not called in JInstaller
$mockInstaller->expects($this->once())
@@ -1166,7 +1219,9 @@ public function testInstallWithExceptionThrownInAdapterMethods($method)
*/
public function testInstallWithExceptionThrownInFinaliseInstall()
{
- $mockInstaller = $this->getMock('JInstaller', array('abort'));
+ $mockInstaller = $this->getMockBuilder('JInstaller')
+ ->setMethods(array('abort'))
+ ->getMock();
// For this test we to ensure abort is not called in JInstaller
$mockInstaller->expects($this->once())
@@ -1229,7 +1284,7 @@ public function testInstallWithExceptionThrownInFinaliseInstall()
*/
public function testParseQueriesWithInstallRoute()
{
- $mockInstaller = $this->getMock('JInstaller');
+ $mockInstaller = $this->getMockBuilder('JInstaller')->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass(
'JInstallerAdapter',
@@ -1259,7 +1314,10 @@ public function testParseQueriesWithUpdateRouteAndParsingReturningFalseReturnsEx
// The sample Schema
$schema = simplexml_load_string('sql/updates/mysql');
- $mockInstaller = $this->getMock('JInstaller', array('parseSchemaUpdates'));
+ $mockInstaller = $this->getMockBuilder('JInstaller')
+ ->setMethods(array('parseSchemaUpdates'))
+ ->getMock();
+
$mockInstaller->expects($this->once())
->method('parseSchemaUpdates')
->with($schema->update->schemas, 444)
@@ -1278,7 +1336,10 @@ public function testParseQueriesWithUpdateRouteAndParsingReturningFalseReturnsEx
TestReflection::setValue($object, 'route', 'update');
// Set up a mock JTableExtension
- $mockTableExtension = $this->getMock('JTableExtension', array('find', 'load'), array($this->getMockDatabase()));
+ $mockTableExtension = $this->getMockBuilder('JTableExtension')
+ ->setMethods(array('find', 'load'))
+ ->setConstructorArgs(array($this->getMockDatabase()))
+ ->getMock();
$mockTableExtension->extension_id = 444;
TestReflection::setValue($object, 'extension', $mockTableExtension);
@@ -1300,7 +1361,9 @@ public function testParseQueriesWithUpdateRouteAndParsingReturningTrueCallsParse
// The sample Schema
$schema = simplexml_load_string('sql/updates/mysql');
- $mockInstaller = $this->getMock('JInstaller', array('parseSchemaUpdates'));
+ $mockInstaller = $this->getMockBuilder('JInstaller')
+ ->setMethods(array('parseSchemaUpdates'))
+ ->getMock();
$mockInstaller->expects($this->once())
->method('parseSchemaUpdates')
->with($schema->update->schemas, 444)
@@ -1319,7 +1382,10 @@ public function testParseQueriesWithUpdateRouteAndParsingReturningTrueCallsParse
TestReflection::setValue($object, 'route', 'update');
// Set up a mock JTableExtension
- $mockTableExtension = $this->getMock('JTableExtension', array('find', 'load'), array($this->getMockDatabase()));
+ $mockTableExtension = $this->getMockBuilder('JTableExtension')
+ ->setMethods(array('find', 'load'))
+ ->setConstructorArgs(array($this->getMockDatabase()))
+ ->getMock();
$mockTableExtension->extension_id = 444;
TestReflection::setValue($object, 'extension', $mockTableExtension);
@@ -1338,7 +1404,7 @@ public function testParseQueriesWithUpdateRouteAndParsingReturningTrueCallsParse
*/
public function testSetManifest()
{
- $mockInstaller = $this->getMock('JInstaller');
+ $mockInstaller = $this->getMockBuilder('JInstaller')->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass('JInstallerAdapter', array($mockInstaller, $mockDatabase));
$manifestObject = simplexml_load_string($this->sampleManifest);
@@ -1364,7 +1430,7 @@ public function testSetManifest()
*/
public function testSetRoute()
{
- $mockInstaller = $this->getMock('JInstaller');
+ $mockInstaller = $this->getMockBuilder('JInstaller')->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass('JInstallerAdapter', array($mockInstaller, $mockDatabase));
@@ -1411,12 +1477,16 @@ public function casesTestTriggerManifestScript()
*/
public function testTriggerManifestScriptForMethodsTakingInstallerObjectOnly($method)
{
- $mockInstaller = $this->getMock('JInstaller', array('set'));
+ $mockInstaller = $this->getMockBuilder('JInstaller')
+ ->setMethods(array('set'))
+ ->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass('JInstallerAdapter', array($mockInstaller, $mockDatabase));
- $mockScript = $this->getMock('DummyScript', array('preflight', 'postflight', 'install', 'uninstall', 'update'));
+ $mockScript = $this->getMockBuilder('DummyScript')
+ ->setMethods(array('preflight', 'postflight', 'install', 'uninstall', 'update'))
+ ->getMock();
$mockScript->expects($this->once())
->method($method)
@@ -1453,12 +1523,16 @@ public function casesTestTriggerManifestScriptFlights()
*/
public function testTriggerManifestScriptForMethodsTakingInstallerObjectAndRoute($method)
{
- $mockInstaller = $this->getMock('JInstaller', array('set'));
+ $mockInstaller = $this->getMockBuilder('JInstaller')
+ ->setMethods(array('set'))
+ ->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass('JInstallerAdapter', array($mockInstaller, $mockDatabase));
- $mockScript = $this->getMock('DummyScript', array('preflight', 'postflight', 'install', 'uninstall', 'update'));
+ $mockScript = $this->getMockBuilder('DummyScript')
+ ->setMethods(array('preflight', 'postflight', 'install', 'uninstall', 'update'))
+ ->getMock();
$routeValue = 'update';
TestReflection::setValue($object, 'route', $routeValue);
@@ -1483,12 +1557,16 @@ public function testTriggerManifestScriptForMethodsTakingInstallerObjectAndRoute
*/
public function testTriggerManifestScriptPreflightReturningFalseThrowsException()
{
- $mockInstaller = $this->getMock('JInstaller', array('set'));
+ $mockInstaller = $this->getMockBuilder('JInstaller')
+ ->setMethods(array('set'))
+ ->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass('JInstallerAdapter', array($mockInstaller, $mockDatabase));
- $mockScript = $this->getMock('DummyScript', array('preflight', 'postflight', 'install', 'uninstall', 'update'));
+ $mockScript = $this->getMockBuilder('DummyScript')
+ ->setMethods(array('preflight', 'postflight', 'install', 'uninstall', 'update'))
+ ->getMock();
$routeValue = 'update';
TestReflection::setValue($object, 'route', $routeValue);
@@ -1527,12 +1605,16 @@ public function casesTestTriggerManifestException()
*/
public function testTriggerManifestScriptInstallOrUpdateReturningFalseThrowsException($method)
{
- $mockInstaller = $this->getMock('JInstaller', array('set'));
+ $mockInstaller = $this->getMockBuilder('JInstaller')
+ ->setMethods(array('set'))
+ ->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass('JInstallerAdapter', array($mockInstaller, $mockDatabase));
- $mockScript = $this->getMock('DummyScript', array('preflight', 'postflight', 'install', 'uninstall', 'update'));
+ $mockScript = $this->getMockBuilder('DummyScript')
+ ->setMethods(array('preflight', 'postflight', 'install', 'uninstall', 'update'))
+ ->getMock();
TestReflection::setValue($object, 'route', $method);
@@ -1553,12 +1635,16 @@ public function testTriggerManifestScriptInstallOrUpdateReturningFalseThrowsExce
*/
public function testTriggerManifestScriptUninstallReturningFalseDoesNotThrowAnException()
{
- $mockInstaller = $this->getMock('JInstaller', array('set'));
+ $mockInstaller = $this->getMockBuilder('JInstaller')
+ ->setMethods(array('set'))
+ ->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass('JInstallerAdapter', array($mockInstaller, $mockDatabase));
- $mockScript = $this->getMock('DummyScript', array('preflight', 'postflight', 'install', 'uninstall', 'update'));
+ $mockScript = $this->getMockBuilder('DummyScript')
+ ->setMethods(array('preflight', 'postflight', 'install', 'uninstall', 'update'))
+ ->getMock();
TestReflection::setValue($object, 'route', 'uninstall');
@@ -1581,12 +1667,16 @@ public function testTriggerManifestScriptUninstallReturningFalseDoesNotThrowAnEx
*/
public function testTriggerManifestScriptPostflightReturningFalseDoesNotThrowAnException()
{
- $mockInstaller = $this->getMock('JInstaller', array('set'));
+ $mockInstaller = $this->getMockBuilder('JInstaller')
+ ->setMethods(array('set'))
+ ->getMock();
$mockDatabase = $this->getMockDatabase();
$object = $this->getMockForAbstractClass('JInstallerAdapter', array($mockInstaller, $mockDatabase));
- $mockScript = $this->getMock('DummyScript', array('preflight', 'postflight', 'install', 'uninstall', 'update'));
+ $mockScript = $this->getMockBuilder('DummyScript')
+ ->setMethods(array('preflight', 'postflight', 'install', 'uninstall', 'update'))
+ ->getMock();
TestReflection::setValue($object, 'route', 'uninstall');
@@ -1609,7 +1699,9 @@ public function testTriggerManifestScriptPostflightReturningFalseDoesNotThrowAnE
*/
public function testUpdate()
{
- $mockInstaller = $this->getMock('JInstaller', array('setOverwrite', 'setUpgrade'));
+ $mockInstaller = $this->getMockBuilder('JInstaller')
+ ->setMethods(array('setOverwrite', 'setUpgrade'))
+ ->getMock();
$mockInstaller->expects($this->once())
->method('setUpgrade')
diff --git a/tests/unit/suites/libraries/cms/installer/JInstallerTest.php b/tests/unit/suites/libraries/cms/installer/JInstallerTest.php
index 6701bfb325a6c..2e5dd73a78866 100644
--- a/tests/unit/suites/libraries/cms/installer/JInstallerTest.php
+++ b/tests/unit/suites/libraries/cms/installer/JInstallerTest.php
@@ -210,7 +210,10 @@ public function testAbortQuery()
*/
public function testAbortDefault()
{
- $adapterMock = $this->getMock('test', array('_rollback_testtype'));
+ // Build the mock object.
+ $adapterMock = $this->getMockBuilder('test')
+ ->setMethods(array('_rollback_testtype'))
+ ->getMock();
$adapterMock->expects($this->once())
->method('_rollback_testtype')
diff --git a/tests/unit/suites/libraries/cms/language/JLanguageMultilangTest.php b/tests/unit/suites/libraries/cms/language/JLanguageMultilangTest.php
index bf7a21713720d..715463e0a383d 100644
--- a/tests/unit/suites/libraries/cms/language/JLanguageMultilangTest.php
+++ b/tests/unit/suites/libraries/cms/language/JLanguageMultilangTest.php
@@ -141,7 +141,8 @@ public function testIsEnabledWithSiteApp()
*/
public function testIsEnabledWithAdminApp()
{
- $mockApplication = $this->getMock('JApplicationAdministrator');
+ // Build the mock object.
+ $mockApplication = $this->getMockBuilder('JApplicationAdministrator')->getMock();
$mockApplication->expects($this->any())
->method('isSite')
->willReturn(false);
diff --git a/tests/unit/suites/libraries/cms/router/JRouterTest.php b/tests/unit/suites/libraries/cms/router/JRouterTest.php
index 40896e8ed029d..06d772ce067b4 100644
--- a/tests/unit/suites/libraries/cms/router/JRouterTest.php
+++ b/tests/unit/suites/libraries/cms/router/JRouterTest.php
@@ -396,7 +396,7 @@ public function testParseRulesCanReplacePresetVariables($preset, $rules, $stage,
$this->object->attachParseRule($rule, $stage);
}
- $uri = $this->getMock('JUri');
+ $uri = $this->getMockBuilder('JUri')->getMock();
$this->assertEquals($expected, $this->object->parse($uri));
}
@@ -459,7 +459,7 @@ public function testParseRulesCanAddVariables($preset, $rules, $stage, $expected
$this->object->attachParseRule($rule, $stage);
}
- $uri = $this->getMock('JUri');
+ $uri = $this->getMockBuilder('JUri')->getMock();
$this->assertEquals($expected, $this->object->parse($uri));
}
@@ -534,7 +534,7 @@ public function testFirstParseRuleTakesPrecedence($preset, $rules, $stage, $expe
$this->object->attachParseRule($rule, $stage);
}
- $uri = $this->getMock('JUri');
+ $uri = $this->getMockBuilder('JUri')->getMock();
$this->assertEquals($expected, $this->object->parse($uri));
}
diff --git a/tests/unit/suites/libraries/joomla/application/JApplicationBaseTest.php b/tests/unit/suites/libraries/joomla/application/JApplicationBaseTest.php
index 3c4845f85f754..52990fe90a988 100644
--- a/tests/unit/suites/libraries/joomla/application/JApplicationBaseTest.php
+++ b/tests/unit/suites/libraries/joomla/application/JApplicationBaseTest.php
@@ -39,8 +39,8 @@ public function test__constructDefaultBehaviour()
*/
public function test__constructDependencyInjection()
{
- $mockInput = $this->getMock('JInput');
- $mockConfig = $this->getMock('Joomla\Registry\Registry');
+ $mockInput = $this->getMockBuilder('JInput')->getMock();
+ $mockConfig = $this->getMockBuilder('Joomla\Registry\Registry')->getMock();
$object = $this->getMockForAbstractClass('JApplicationBase', array($mockInput, $mockConfig));
$this->assertAttributeSame($mockInput, 'input', $object);
@@ -82,7 +82,14 @@ public function testExecute()
*/
public function testGet()
{
- $mockConfig = $this->getMock('Joomla\Registry\Registry', array('get'), array(array('foo' => 'bar')), '', true, true, true, false, true);
+ // Build the mock object.
+ $mockConfig = $this->getMockBuilder('Joomla\Registry\Registry')
+ ->setMethods(array('get'))
+ ->setConstructorArgs(array(array('foo' => 'bar')))
+ ->setMockClassName('')
+ ->disableOriginalClone()
+ ->enableProxyingToOriginalMethods()
+ ->getMock();
// Inject the mock config
$this->class->setConfiguration($mockConfig);
@@ -153,7 +160,7 @@ public function testLoadIdentity()
// We need to mock JSession for this test, don't use the getMockSession() method since it has an inbuilt method to mock loading the user
$this->saveFactoryState();
- JFactory::$session = $this->getMock('JSession');
+ JFactory::$session = $this->getMockBuilder('JSession')->getMock();
// Before running, this should be null
$this->assertAttributeNotInstanceOf('JUser', 'identity', $this->class);
@@ -175,7 +182,7 @@ public function testLoadIdentity()
*/
public function testLoadIdentityWithInjectedUser()
{
- $mockUser = $this->getMock('JUser');
+ $mockUser = $this->getMockBuilder('JUser')->getMock();
// Validate method chaining
$this->assertSame($this->class, $this->class->loadIdentity($mockUser));
@@ -210,8 +217,14 @@ public function testRegisterEvent()
*/
public function testSet()
{
- $mockConfig = $this->getMock('Joomla\Registry\Registry', array('get', 'set'), array(array('foo' => 'bar')), '', true, true, true, false, true);
-
+ // Build the mock object.
+ $mockConfig = $this->getMockBuilder('Joomla\Registry\Registry')
+ ->setMethods(array('get', 'set'))
+ ->setConstructorArgs(array(array('foo' => 'bar')))
+ ->setMockClassName('')
+ ->disableOriginalClone()
+ ->enableProxyingToOriginalMethods()
+ ->getMock();
$this->class->setConfiguration($mockConfig);
$this->assertEquals('bar', $this->class->set('foo', 'car'), 'Checks set returns the previous value.');
@@ -225,7 +238,7 @@ public function testSet()
*/
public function testSetConfiguration()
{
- $mockConfig = $this->getMock('Joomla\Registry\Registry');
+ $mockConfig = $this->getMockBuilder('Joomla\Registry\Registry')->getMock();
$this->class->setConfiguration($mockConfig);
diff --git a/tests/unit/suites/libraries/joomla/application/JApplicationCliTest.php b/tests/unit/suites/libraries/joomla/application/JApplicationCliTest.php
index 5b50ef523ca9a..dab66e0f63c2d 100644
--- a/tests/unit/suites/libraries/joomla/application/JApplicationCliTest.php
+++ b/tests/unit/suites/libraries/joomla/application/JApplicationCliTest.php
@@ -92,12 +92,23 @@ public function test__constructDependancyInjection()
$this->markTestSkipped('Test is skipped due to a PHP bug in versions 5.4.29 and 5.5.13 and a change in behavior in the 5.6 branch');
}
- $mockInput = $this->getMock('JInputCli', array('test'), array(), '', false);
+ // Build the mock object.
+ $mockInput = $this->getMockBuilder('JInputCli')
+ ->setMethods(array('test'))
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
+
$mockInput->expects($this->any())
->method('test')
->willReturn('ok');
- $mockConfig = $this->getMock('\\Joomla\\Registry\\Registry', array('test'), array(null), '', true);
+ $mockConfig = $this->getMockBuilder('\\Joomla\\Registry\\Registry')
+ ->setMethods(array('test'))
+ ->setConstructorArgs(array(null))
+ ->setMockClassName('')
+ ->getMock();
$mockConfig
->expects($this->any())
->method('test')
@@ -108,7 +119,10 @@ public function test__constructDependancyInjection()
->method('test')
->willReturn('ok');
- $class = $this->getMock('JApplicationCli', array(), array($mockInput, $mockConfig, $mockDispatcher));
+ $class = $this->getMockBuilder('JApplicationCli')
+ ->setMethods(array())
+ ->setConstructorArgs(array($mockInput, $mockConfig, $mockDispatcher))
+ ->getMock();
$this->assertEquals('ok', $class->input->test(), 'Tests input injection.');
$this->assertEquals('ok', TestReflection::getValue($class, 'config')->test(), 'Tests config injection.');
diff --git a/tests/unit/suites/libraries/joomla/application/JApplicationWebTest.php b/tests/unit/suites/libraries/joomla/application/JApplicationWebTest.php
index 9cb2e929bdb2a..45eebdf0b9d69 100644
--- a/tests/unit/suites/libraries/joomla/application/JApplicationWebTest.php
+++ b/tests/unit/suites/libraries/joomla/application/JApplicationWebTest.php
@@ -181,18 +181,33 @@ public function test__constructDependancyInjection()
$this->markTestSkipped('Test is skipped due to a PHP bug in versions 5.4.29 and 5.5.13 and a change in behavior in the 5.6 branch');
}
- $mockInput = $this->getMock('JInput', array('test'), array(), '', false);
+ // Build the mock object.
+ $mockInput = $this->getMockBuilder('JInput')
+ ->setMethods(array('test'))
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
$mockInput->expects($this->any())
->method('test')
->willReturn('ok');
- $mockConfig = $this->getMock('\\Joomla\\Registry\\Registry', array('test'), array(null), '', true);
+ $mockConfig = $this->getMockBuilder('\\Joomla\\Registry\\Registry')
+ ->setMethods(array('test'))
+ ->setConstructorArgs(array(null))
+ ->setMockClassName('')
+ ->getMock();
$mockConfig
->expects($this->any())
->method('test')
->willReturn('ok');
- $mockClient = $this->getMock('JApplicationWebClient', array('test'), array(), '', false);
+ $mockClient = $this->getMockBuilder('JApplicationWebClient')
+ ->setMethods(array('test'))
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
$mockClient->expects($this->any())
->method('test')
->willReturn('ok');
@@ -829,25 +844,46 @@ public function testInitialiseWithFalse()
*/
public function testInitialiseWithInjection()
{
- $mockSession = $this->getMock('JSession', array('test'), array(), '', false);
+ // Build the mock object.
+ $mockSession = $this->getMockBuilder('JSession')
+ ->setMethods(array('test'))
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
$mockSession
->expects($this->any())
->method('test')
->willReturnSelf();
- $mockDocument = $this->getMock('JDocument', array('test'), array(), '', false);
+ $mockDocument = $this->getMockBuilder('JDocument')
+ ->setMethods(array('test'))
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
$mockDocument
->expects($this->any())
->method('test')
->willReturnSelf();
- $mockLanguage = $this->getMock('JLanguage', array('test'), array(), '', false);
+ $mockLanguage = $this->getMockBuilder('JLanguage')
+ ->setMethods(array('test'))
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
$mockLanguage
->expects($this->any())
->method('test')
->willReturnSelf();
- $mockDispatcher = $this->getMock('JEventDispatcher', array('test'), array(), '', false);
+ $mockDispatcher = $this->getMockBuilder('JEventDispatcher')
+ ->setMethods(array('test'))
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
$mockDispatcher
->expects($this->any())
->method('test')
diff --git a/tests/unit/suites/libraries/joomla/crypt/password/JCryptPasswordSimpleTest.php b/tests/unit/suites/libraries/joomla/crypt/password/JCryptPasswordSimpleTest.php
index 5a9c3255c140f..ce8e08c7cec44 100644
--- a/tests/unit/suites/libraries/joomla/crypt/password/JCryptPasswordSimpleTest.php
+++ b/tests/unit/suites/libraries/joomla/crypt/password/JCryptPasswordSimpleTest.php
@@ -73,7 +73,7 @@ public function createExceptionData()
*/
public function testCreateException($password, $type, $salt, $expected, $cost)
{
- $hasher = $this->getMock('JCryptPasswordSimple', array('getSalt'));
+ $hasher = $this->getMockBuilder('JCryptPasswordSimple')->setMethods(array('getSalt'))->getMock();
$hasher->setCost($cost);
$hasher->expects($this->any())
@@ -104,7 +104,7 @@ public function testCreateException($password, $type, $salt, $expected, $cost)
*/
public function testCreate($password, $type, $salt, $expected, $cost = 10)
{
- $hasher = $this->getMock('JCryptPasswordSimple', array('getSalt'));
+ $hasher = $this->getMockBuilder('JCryptPasswordSimple')->setMethods(array('getSalt'))->getMock();
$hasher->setCost($cost);
diff --git a/tests/unit/suites/libraries/joomla/document/feed/renderer/JDocumentRendererAtomTest.php b/tests/unit/suites/libraries/joomla/document/feed/renderer/JDocumentRendererAtomTest.php
index 05d3aef4e4b21..87d202fb2344d 100644
--- a/tests/unit/suites/libraries/joomla/document/feed/renderer/JDocumentRendererAtomTest.php
+++ b/tests/unit/suites/libraries/joomla/document/feed/renderer/JDocumentRendererAtomTest.php
@@ -47,14 +47,9 @@ protected function setUp()
$this->saveFactoryState();
- JFactory::$application = $this->getMock(
- 'JApplication',
- array(
- 'get',
- 'getCfg',
- 'getRouter',
- )
- );
+ JFactory::$application = $this->getMockBuilder('JApplication')
+ ->setMethods(array('get', 'getCfg', 'getRouter'))
+ ->getMock();
JFactory::$application
->expects($this->any())
@@ -63,10 +58,7 @@ protected function setUp()
$this->returnValue(new JRouter)
);
- JFactory::$config = $this->getMock(
- 'JConfig',
- array('get')
- );
+ JFactory::$config = $this->getMockBuilder('JConfig')->setMethods(array('get'))->getMock();
$_SERVER['REQUEST_METHOD'] = 'get';
$input = JFactory::getApplication()->input;
diff --git a/tests/unit/suites/libraries/joomla/document/feed/renderer/JDocumentRendererRSSTest.php b/tests/unit/suites/libraries/joomla/document/feed/renderer/JDocumentRendererRSSTest.php
index 7aee661d92048..a643675fed5a5 100644
--- a/tests/unit/suites/libraries/joomla/document/feed/renderer/JDocumentRendererRSSTest.php
+++ b/tests/unit/suites/libraries/joomla/document/feed/renderer/JDocumentRendererRSSTest.php
@@ -47,14 +47,9 @@ protected function setUp()
$this->saveFactoryState();
- JFactory::$application = $this->getMock(
- 'JApplication',
- array(
- 'get',
- 'getCfg',
- 'getRouter',
- )
- );
+ JFactory::$application = $this->getMockBuilder('JApplication')
+ ->setMethods(array('get', 'getCfg', 'getRouter'))
+ ->getMock();
JFactory::$application
->expects($this->any())
@@ -63,10 +58,7 @@ protected function setUp()
$this->returnValue(new JRouter)
);
- JFactory::$config = $this->getMock(
- 'JConfig',
- array('get')
- );
+ JFactory::$config = $this->getMockBuilder('JConfig')->setMethods(array('get'))->getMock();
$_SERVER['REQUEST_METHOD'] = 'get';
$input = JFactory::getApplication()->input;
diff --git a/tests/unit/suites/libraries/joomla/event/JEventTest.php b/tests/unit/suites/libraries/joomla/event/JEventTest.php
index 3f1019c2d4b5d..f5311d8cb5575 100644
--- a/tests/unit/suites/libraries/joomla/event/JEventTest.php
+++ b/tests/unit/suites/libraries/joomla/event/JEventTest.php
@@ -92,8 +92,8 @@ public function testUpdate()
*/
public function testUpdateNoArgs()
{
- // Get a mock for the
- $observable = $this->getMock('Observable', array('attach'));
+ // Build the mock object
+ $observable = $this->getMockBuilder('Observable')->setMethods(array('attach'))->getMock();
// We expect that the attach method of our mock object will be called because
// when we instantiate an observer it needs something observable to attach itself to
@@ -143,8 +143,8 @@ public function testUpdateNoArgs()
*/
public function testUpdateOneArg()
{
- // Get a mock for the
- $observable = $this->getMock('Observable', array('attach'));
+ // Build the mock object
+ $observable = $this->getMockBuilder('Observable')->setMethods(array('attach'))->getMock();
// We expect that the attach method of our mock object will be called because
// when we instantiate an observer it needs something observable to attach itself to
@@ -193,8 +193,8 @@ public function testUpdateOneArg()
*/
public function testUpdateMultipleArgs()
{
- // Get a mock for the
- $observable = $this->getMock('Observable', array('attach'));
+ // Build the mock object
+ $observable = $this->getMockBuilder('Observable')->setMethods(array('attach'))->getMock();
// We expect that the attach method of our mock object will be called because
// when we instantiate an observer it needs something observable to attach itself to
@@ -243,8 +243,8 @@ public function testUpdateMultipleArgs()
*/
public function testUpdateBadEvent()
{
- // Get a mock for the
- $observable = $this->getMock('Observable', array('attach'));
+ // Build the mock object
+ $observable = $this->getMockBuilder('Observable')->setMethods(array('attach'))->getMock();
// We expect that the attach method of our mock object will be called because
// when we instantiate an observer it needs something observable to attach itself to
diff --git a/tests/unit/suites/libraries/joomla/facebook/JFacebookAlbumTest.php b/tests/unit/suites/libraries/joomla/facebook/JFacebookAlbumTest.php
index cf9c2a9539c27..6f145dd8fdd94 100644
--- a/tests/unit/suites/libraries/joomla/facebook/JFacebookAlbumTest.php
+++ b/tests/unit/suites/libraries/joomla/facebook/JFacebookAlbumTest.php
@@ -87,7 +87,7 @@ protected function setUp()
);
$this->options = new Registry;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->input = new JInput;
$this->oauth = new JFacebookOauth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/facebook/JFacebookCheckinTest.php b/tests/unit/suites/libraries/joomla/facebook/JFacebookCheckinTest.php
index f5db4c3b79c8e..44e54790eac50 100644
--- a/tests/unit/suites/libraries/joomla/facebook/JFacebookCheckinTest.php
+++ b/tests/unit/suites/libraries/joomla/facebook/JFacebookCheckinTest.php
@@ -87,7 +87,7 @@ protected function setUp()
);
$this->options = new Registry;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->input = new JInput;
$this->oauth = new JFacebookOauth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/facebook/JFacebookCommentTest.php b/tests/unit/suites/libraries/joomla/facebook/JFacebookCommentTest.php
index 74dea8019390e..f785c027e3554 100644
--- a/tests/unit/suites/libraries/joomla/facebook/JFacebookCommentTest.php
+++ b/tests/unit/suites/libraries/joomla/facebook/JFacebookCommentTest.php
@@ -87,7 +87,7 @@ protected function setUp()
);
$this->options = new Registry;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->input = new JInput;
$this->oauth = new JFacebookOauth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/facebook/JFacebookEventTest.php b/tests/unit/suites/libraries/joomla/facebook/JFacebookEventTest.php
index e0737bf4bb276..8618d306fd1bb 100644
--- a/tests/unit/suites/libraries/joomla/facebook/JFacebookEventTest.php
+++ b/tests/unit/suites/libraries/joomla/facebook/JFacebookEventTest.php
@@ -93,7 +93,7 @@ protected function setUp()
);
$this->options = new Registry;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->input = new JInput;
$this->oauth = new JFacebookOauth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/facebook/JFacebookGroupTest.php b/tests/unit/suites/libraries/joomla/facebook/JFacebookGroupTest.php
index 7e61f890000a1..717ceeba466c3 100644
--- a/tests/unit/suites/libraries/joomla/facebook/JFacebookGroupTest.php
+++ b/tests/unit/suites/libraries/joomla/facebook/JFacebookGroupTest.php
@@ -91,7 +91,7 @@ protected function setUp()
'expires' => '51837673', 'created' => '2443672521');
$this->options = new Registry;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->input = new JInput;
$this->oauth = new JFacebookOauth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/facebook/JFacebookLinkTest.php b/tests/unit/suites/libraries/joomla/facebook/JFacebookLinkTest.php
index 0f26d13ac65bb..3b1eefa5b16ec 100644
--- a/tests/unit/suites/libraries/joomla/facebook/JFacebookLinkTest.php
+++ b/tests/unit/suites/libraries/joomla/facebook/JFacebookLinkTest.php
@@ -91,7 +91,7 @@ protected function setUp()
'expires' => '51837673', 'created' => '2443672521');
$this->options = new Registry;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->input = new JInput;
$this->oauth = new JFacebookOauth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/facebook/JFacebookNoteTest.php b/tests/unit/suites/libraries/joomla/facebook/JFacebookNoteTest.php
index e7ce88161f9ee..f3674a067d027 100644
--- a/tests/unit/suites/libraries/joomla/facebook/JFacebookNoteTest.php
+++ b/tests/unit/suites/libraries/joomla/facebook/JFacebookNoteTest.php
@@ -85,7 +85,7 @@ protected function setUp()
'expires' => '51837673', 'created' => '2443672521');
$this->options = new Registry;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->input = new JInput;
$this->oauth = new JFacebookOauth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/facebook/JFacebookOauthTest.php b/tests/unit/suites/libraries/joomla/facebook/JFacebookOauthTest.php
index 9254273c16c12..2e2bfb112805d 100644
--- a/tests/unit/suites/libraries/joomla/facebook/JFacebookOauthTest.php
+++ b/tests/unit/suites/libraries/joomla/facebook/JFacebookOauthTest.php
@@ -66,7 +66,7 @@ protected function setUp()
$_SERVER['SCRIPT_NAME'] = '/index.php';
$this->options = new Registry;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->input = new JInput;
$this->object = new JFacebookOauth($this->options, $this->client, $this->input);
diff --git a/tests/unit/suites/libraries/joomla/facebook/JFacebookObjectTest.php b/tests/unit/suites/libraries/joomla/facebook/JFacebookObjectTest.php
index 42c3dc61de97d..cdca07dfc2541 100644
--- a/tests/unit/suites/libraries/joomla/facebook/JFacebookObjectTest.php
+++ b/tests/unit/suites/libraries/joomla/facebook/JFacebookObjectTest.php
@@ -74,7 +74,7 @@ protected function setUp()
$_SERVER['SCRIPT_NAME'] = '/index.php';
$this->options = new Registry;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->object = new JFacebookObjectMock($this->options, $this->client);
diff --git a/tests/unit/suites/libraries/joomla/facebook/JFacebookPhotoTest.php b/tests/unit/suites/libraries/joomla/facebook/JFacebookPhotoTest.php
index 781ae5d7c3f1a..8fb6137dd47e1 100644
--- a/tests/unit/suites/libraries/joomla/facebook/JFacebookPhotoTest.php
+++ b/tests/unit/suites/libraries/joomla/facebook/JFacebookPhotoTest.php
@@ -85,7 +85,7 @@ protected function setUp()
'expires' => '51837673', 'created' => '2443672521');
$this->options = new Registry;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->input = new JInput;
$this->oauth = new JFacebookOauth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/facebook/JFacebookPostTest.php b/tests/unit/suites/libraries/joomla/facebook/JFacebookPostTest.php
index 68d5e2146900a..c5b95e47e4224 100644
--- a/tests/unit/suites/libraries/joomla/facebook/JFacebookPostTest.php
+++ b/tests/unit/suites/libraries/joomla/facebook/JFacebookPostTest.php
@@ -85,7 +85,7 @@ protected function setUp()
'expires' => '51837673', 'created' => '2443672521');
$this->options = new Registry;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->input = new JInput;
$this->oauth = new JFacebookOauth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/facebook/JFacebookStatusTest.php b/tests/unit/suites/libraries/joomla/facebook/JFacebookStatusTest.php
index 7f43c47752889..8f77f972e1a9c 100644
--- a/tests/unit/suites/libraries/joomla/facebook/JFacebookStatusTest.php
+++ b/tests/unit/suites/libraries/joomla/facebook/JFacebookStatusTest.php
@@ -85,7 +85,7 @@ protected function setUp()
'expires' => '51837673', 'created' => '2443672521');
$this->options = new Registry;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->input = new JInput;
$this->oauth = new JFacebookOauth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/facebook/JFacebookTest.php b/tests/unit/suites/libraries/joomla/facebook/JFacebookTest.php
index f76fbc6031225..efe783355336e 100644
--- a/tests/unit/suites/libraries/joomla/facebook/JFacebookTest.php
+++ b/tests/unit/suites/libraries/joomla/facebook/JFacebookTest.php
@@ -66,7 +66,7 @@ protected function setUp()
$_SERVER['SCRIPT_NAME'] = '/index.php';
$this->options = new Registry;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->object = new JFacebook($this->oauth, $this->options, $this->client);
diff --git a/tests/unit/suites/libraries/joomla/facebook/JFacebookUserTest.php b/tests/unit/suites/libraries/joomla/facebook/JFacebookUserTest.php
index b9a37295a6ec7..03012e032e28f 100644
--- a/tests/unit/suites/libraries/joomla/facebook/JFacebookUserTest.php
+++ b/tests/unit/suites/libraries/joomla/facebook/JFacebookUserTest.php
@@ -97,7 +97,7 @@ protected function setUp()
'expires' => '51837673', 'created' => '2443672521');
$this->options = new Registry;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->input = new JInput;
$this->oauth = new JFacebookOauth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/facebook/JFacebookVideoTest.php b/tests/unit/suites/libraries/joomla/facebook/JFacebookVideoTest.php
index fd87a2e0d835b..9b57919903967 100644
--- a/tests/unit/suites/libraries/joomla/facebook/JFacebookVideoTest.php
+++ b/tests/unit/suites/libraries/joomla/facebook/JFacebookVideoTest.php
@@ -85,7 +85,7 @@ protected function setUp()
'expires' => '51837673', 'created' => '2443672521');
$this->options = new Registry;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->input = new JInput;
$this->oauth = new JFacebookOauth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php b/tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php
index e3e76983c58c0..f83fd2d76dd9f 100644
--- a/tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php
+++ b/tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php
@@ -41,12 +41,11 @@ class JFeedParserTest extends TestCase
*/
public function testParse()
{
- // Create the mock so we can verify calls.
- $parser = $this->getMock(
- 'JFeedParserMock',
- array('initialise', 'processElement'),
- array($this->_reader)
- );
+ // Build the mock so we can verify calls.
+ $parser = $this->getMockBuilder('JFeedParserMock')
+ ->setMethods(array('initialise', 'processElement'))
+ ->setConstructorArgs(array($this->_reader))
+ ->getMock();
// Setup some expectations for the mock object.
$parser->expects($this->once())->method('initialise');
@@ -81,7 +80,7 @@ public function testRegisterNamespace()
$this->assertAttributeEmpty('namespaces', $this->_instance);
// Add a new namespace.
- $mock = $this->getMock('JFeedParserNamespace');
+ $mock = $this->getMockBuilder('JFeedParserNamespace')->getMock();
$this->_instance->registerNamespace('foo', $mock);
$this->assertAttributeEquals(
@@ -184,7 +183,7 @@ public function testProcessElementWithEntry()
public function testFetchNamespace()
{
// Set a mock namespace into the namespaces for the parser object.
- $mock = $this->getMock('JFeedParserNamespace');
+ $mock = $this->getMockBuilder('JFeedParserNamespace')->getMock();
$namespaces = array('mock' => $mock);
TestReflection::setValue($this->_instance, 'namespaces', $namespaces);
diff --git a/tests/unit/suites/libraries/joomla/form/JFormTest.php b/tests/unit/suites/libraries/joomla/form/JFormTest.php
index c4e749a747d82..464751a50ce6c 100644
--- a/tests/unit/suites/libraries/joomla/form/JFormTest.php
+++ b/tests/unit/suites/libraries/joomla/form/JFormTest.php
@@ -549,7 +549,7 @@ public function testFilterField()
include_once JPATH_BASE . '/libraries/joomla/user/user.php';
$user = new JUser;
- $mockSession = $this->getMock('JSession', array('_start', 'get'));
+ $mockSession = $this->getMockBuilder('JSession')->setMethods(array('_start', 'get'))->getMock();
$mockSession->expects($this->once())->method('get')->will(
$this->returnValue($user)
);
diff --git a/tests/unit/suites/libraries/joomla/form/fields/JFormFieldCheckboxesTest.php b/tests/unit/suites/libraries/joomla/form/fields/JFormFieldCheckboxesTest.php
index a4281cc736ee1..6c1685ae8987b 100644
--- a/tests/unit/suites/libraries/joomla/form/fields/JFormFieldCheckboxesTest.php
+++ b/tests/unit/suites/libraries/joomla/form/fields/JFormFieldCheckboxesTest.php
@@ -65,7 +65,7 @@ protected function tearDown()
*/
public function testGetInputNoValueNoChecked()
{
- $formFieldCheckboxes = $this->getMock('JFormFieldCheckboxes', array('getOptions'));
+ $formFieldCheckboxes = $this->getMockBuilder('JFormFieldCheckboxes')->setMethods(array('getOptions'))->getMock();
$option1 = new JObject;
$option1->set('value', 'red');
@@ -160,7 +160,7 @@ public function testGetInputNoValueNoChecked()
*/
public function testGetInputValueNoChecked()
{
- $formFieldCheckboxes = $this->getMock('JFormFieldCheckboxes', array('getOptions'));
+ $formFieldCheckboxes = $this->getMockBuilder('JFormFieldCheckboxes')->setMethods(array('getOptions'))->getMock();
$option1 = new JObject;
$option1->set('value', 'red');
@@ -244,7 +244,7 @@ public function testGetInputValueNoChecked()
*/
public function testGetInputValueArrayNoChecked()
{
- $formFieldCheckboxes = $this->getMock('JFormFieldCheckboxes', array('getOptions'));
+ $formFieldCheckboxes = $this->getMockBuilder('JFormFieldCheckboxes')->setMethods(array('getOptions'))->getMock();
$option1 = new JObject;
$option1->set('value', 'red');
@@ -329,7 +329,7 @@ public function testGetInputValueArrayNoChecked()
*/
public function testGetInputNoValueOneChecked()
{
- $formFieldCheckboxes = $this->getMock('JFormFieldCheckboxes', array('getOptions'));
+ $formFieldCheckboxes = $this->getMockBuilder('JFormFieldCheckboxes')->setMethods(array('getOptions'))->getMock();
$option1 = new JObject;
$option1->set('value', 'red');
@@ -406,7 +406,7 @@ public function testGetInputNoValueOneChecked()
*/
public function testGetInputNoValueTwoChecked()
{
- $formFieldCheckboxes = $this->getMock('JFormFieldCheckboxes', array('getOptions'));
+ $formFieldCheckboxes = $this->getMockBuilder('JFormFieldCheckboxes')->setMethods(array('getOptions'))->getMock();
$option1 = new JObject;
$option1->set('value', 'red');
@@ -485,7 +485,7 @@ public function testGetInputNoValueTwoChecked()
*/
public function testGetInputValueChecked()
{
- $formFieldCheckboxes = $this->getMock('JFormFieldCheckboxes', array('getOptions'));
+ $formFieldCheckboxes = $this->getMockBuilder('JFormFieldCheckboxes')->setMethods(array('getOptions'))->getMock();
$option1 = new JObject;
$option1->set('value', 'red');
@@ -564,7 +564,7 @@ public function testGetInputValueChecked()
*/
public function testGetInputValuesNoChecked()
{
- $formFieldCheckboxes = $this->getMock('JFormFieldCheckboxes', array('getOptions'));
+ $formFieldCheckboxes = $this->getMockBuilder('JFormFieldCheckboxes')->setMethods(array('getOptions'))->getMock();
$option1 = new JObject;
$option1->set('value', 'red');
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubAccountTest.php b/tests/unit/suites/libraries/joomla/github/JGithubAccountTest.php
index 3e4abc12c5786..70ed861bfa2ea 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubAccountTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubAccountTest.php
@@ -60,7 +60,9 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
+ $this->client = $this->getMockBuilder('JGithubHttp')
+ ->setMethods(array('get', 'post', 'delete', 'patch', 'put'))
+ ->getMock();
$this->object = new JGithubAccount($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubCommitsTest.php b/tests/unit/suites/libraries/joomla/github/JGithubCommitsTest.php
index 4720df4793c5f..10b92d0a19d88 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubCommitsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubCommitsTest.php
@@ -60,7 +60,9 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
+ $this->client = $this->getMockBuilder('JGithubHttp')
+ ->setMethods(array('get', 'post', 'delete', 'patch', 'put'))
+ ->getMock();
$this->object = new JGithubCommits($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubForksTest.php b/tests/unit/suites/libraries/joomla/github/JGithubForksTest.php
index 5aad91a755af2..a91be780ec58f 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubForksTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubForksTest.php
@@ -60,7 +60,7 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
$this->object = new JGithubForks($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubGistsTest.php b/tests/unit/suites/libraries/joomla/github/JGithubGistsTest.php
index 006129fbada1d..a29c497a4bcdb 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubGistsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubGistsTest.php
@@ -66,8 +66,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageGists($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubHooksTest.php b/tests/unit/suites/libraries/joomla/github/JGithubHooksTest.php
index f7eff38bedb49..6859141996bd3 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubHooksTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubHooksTest.php
@@ -65,8 +65,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubHooks($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubHttpTest.php b/tests/unit/suites/libraries/joomla/github/JGithubHttpTest.php
index eb92d5c4bb92e..e962f6340412d 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubHttpTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubHttpTest.php
@@ -48,7 +48,12 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->transport = $this->getMock('JHttpTransportStream', array('request'), array($this->options), 'CustomTransport', false);
+ $this->transport = $this->getMockBuilder('JHttpTransportStream')
+ ->setMethods(array('request'))
+ ->setConstructorArgs(array($this->options))
+ ->setMockClassName('CustomTransport')
+ ->disableOriginalConstructor()
+ ->getMock();
$this->object = new JGithubHttp($this->options, $this->transport);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubIssuesTest.php b/tests/unit/suites/libraries/joomla/github/JGithubIssuesTest.php
index 42283ee4af33b..099206cde522c 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubIssuesTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubIssuesTest.php
@@ -66,8 +66,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageIssues($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubMetaTest.php b/tests/unit/suites/libraries/joomla/github/JGithubMetaTest.php
index a1a32458c9963..7d3ea462c6346 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubMetaTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubMetaTest.php
@@ -65,8 +65,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubMeta($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubMilestonesTest.php b/tests/unit/suites/libraries/joomla/github/JGithubMilestonesTest.php
index bdfccb29ef9eb..1ea8413a6393f 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubMilestonesTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubMilestonesTest.php
@@ -60,7 +60,7 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
$this->object = new JGithubMilestones($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubObjectTest.php b/tests/unit/suites/libraries/joomla/github/JGithubObjectTest.php
index e9f3e7f43034f..377113279d000 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubObjectTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubObjectTest.php
@@ -50,7 +50,7 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
$this->object = new JGithubObjectMock($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubPackageAuthorizationsTest.php b/tests/unit/suites/libraries/joomla/github/JGithubPackageAuthorizationsTest.php
index 26fcf4a7a3a29..b13f51fd12d8e 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubPackageAuthorizationsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageAuthorizationsTest.php
@@ -60,7 +60,7 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
$this->object = new JGithubPackageAuthorization($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubPackageGistsTest.php b/tests/unit/suites/libraries/joomla/github/JGithubPackageGistsTest.php
index 0e74403d7e109..bb13e1889e2de 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubPackageGistsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageGistsTest.php
@@ -64,7 +64,7 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
$this->object = new JGithubPackageGists($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubPackageGitignoreTest.php b/tests/unit/suites/libraries/joomla/github/JGithubPackageGitignoreTest.php
index abf1cea3e2591..2c4f03067b792 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubPackageGitignoreTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageGitignoreTest.php
@@ -53,8 +53,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageGitignore($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubPackageIssuesTest.php b/tests/unit/suites/libraries/joomla/github/JGithubPackageIssuesTest.php
index adce939f548c1..c8baa58baffe9 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubPackageIssuesTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageIssuesTest.php
@@ -66,8 +66,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageIssues($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubPackageMarkdownTest.php b/tests/unit/suites/libraries/joomla/github/JGithubPackageMarkdownTest.php
index 7a7106552e98e..a98d5f621bee8 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubPackageMarkdownTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageMarkdownTest.php
@@ -36,8 +36,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageMarkdown($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubPackageOrgsTest.php b/tests/unit/suites/libraries/joomla/github/JGithubPackageOrgsTest.php
index 4de9f0d6f3a1a..8bcbca43ba83d 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubPackageOrgsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageOrgsTest.php
@@ -52,8 +52,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageOrgs($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubPackagePullsTest.php b/tests/unit/suites/libraries/joomla/github/JGithubPackagePullsTest.php
index c37fe0b607bee..35a8a7d3ec732 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubPackagePullsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubPackagePullsTest.php
@@ -60,7 +60,7 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
$this->object = new JGithubPackagePulls($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubPackageRepositoriesTest.php b/tests/unit/suites/libraries/joomla/github/JGithubPackageRepositoriesTest.php
index c72467cf2c487..d930eb2d607a0 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubPackageRepositoriesTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageRepositoriesTest.php
@@ -52,8 +52,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageRepositories($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubPackageSearchTest.php b/tests/unit/suites/libraries/joomla/github/JGithubPackageSearchTest.php
index 57c0828ccfb7e..bd2b36673b48b 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubPackageSearchTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageSearchTest.php
@@ -52,8 +52,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageSearch($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubPackageUsersTest.php b/tests/unit/suites/libraries/joomla/github/JGithubPackageUsersTest.php
index 93d22c68c5ec3..9d87506513641 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubPackageUsersTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageUsersTest.php
@@ -60,8 +60,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageUsers($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubPullsTest.php b/tests/unit/suites/libraries/joomla/github/JGithubPullsTest.php
index 0310a2ed3b821..44a6eb0d575b7 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubPullsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubPullsTest.php
@@ -66,8 +66,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackagePulls($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubRefsTest.php b/tests/unit/suites/libraries/joomla/github/JGithubRefsTest.php
index 5838f6e336142..8f6f605e903cd 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubRefsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubRefsTest.php
@@ -60,7 +60,7 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
$this->object = new JGithubRefs($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubStatusesTest.php b/tests/unit/suites/libraries/joomla/github/JGithubStatusesTest.php
index b3c941c8fe0d2..91fdba7f009d5 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubStatusesTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubStatusesTest.php
@@ -60,7 +60,7 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
$this->object = new JGithubStatuses($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubTest.php b/tests/unit/suites/libraries/joomla/github/JGithubTest.php
index bf0cc925c1fd1..033b9d7ebe30f 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubTest.php
@@ -48,7 +48,7 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
$this->object = new JGithub($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/JGithubUsersTest.php b/tests/unit/suites/libraries/joomla/github/JGithubUsersTest.php
index 6ddfda5a38687..bcf9bf2e287ca 100644
--- a/tests/unit/suites/libraries/joomla/github/JGithubUsersTest.php
+++ b/tests/unit/suites/libraries/joomla/github/JGithubUsersTest.php
@@ -54,8 +54,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageUsers($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityEventsTest.php b/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityEventsTest.php
index 70529966721ca..84d492e09661d 100644
--- a/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityEventsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityEventsTest.php
@@ -93,7 +93,7 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
$this->object = new JGithubPackageActivityEvents($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityNotificationsTest.php b/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityNotificationsTest.php
index 27ebdfb6ee942..c9b182fd412fa 100644
--- a/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityNotificationsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityNotificationsTest.php
@@ -49,8 +49,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageActivityNotifications($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityStarringTest.php b/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityStarringTest.php
index 3bf171a634aaf..fac40a6676ec4 100644
--- a/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityStarringTest.php
+++ b/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityStarringTest.php
@@ -49,8 +49,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageActivityStarring($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityWatchingTest.php b/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityWatchingTest.php
index eada284598d50..a974f55c5d7bf 100644
--- a/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityWatchingTest.php
+++ b/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityWatchingTest.php
@@ -49,8 +49,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageActivityWatching($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataBlobsTest.php b/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataBlobsTest.php
index 9ab274862b3f5..4c64c7a9c165e 100644
--- a/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataBlobsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataBlobsTest.php
@@ -49,8 +49,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageDataBlobs($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataCommitsTest.php b/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataCommitsTest.php
index 38ce572e4609d..8de4a8df1cbee 100644
--- a/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataCommitsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataCommitsTest.php
@@ -49,8 +49,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageDataCommits($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataRefsTest.php b/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataRefsTest.php
index 85e32135238a2..74945dc5f9b3e 100644
--- a/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataRefsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataRefsTest.php
@@ -66,8 +66,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageDataRefs($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataTagsTest.php b/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataTagsTest.php
index 152d2b44dd335..5626b054c38af 100644
--- a/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataTagsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataTagsTest.php
@@ -49,8 +49,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageDataTags($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataTreesTest.php b/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataTreesTest.php
index b26d2c7b0955b..f93db7caee828 100644
--- a/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataTreesTest.php
+++ b/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataTreesTest.php
@@ -49,8 +49,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageDataTrees($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesAssigneesTest.php b/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesAssigneesTest.php
index 18c1d8da6741d..418bea24a8da3 100644
--- a/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesAssigneesTest.php
+++ b/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesAssigneesTest.php
@@ -40,8 +40,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageIssuesAssignees($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesCommentsTest.php b/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesCommentsTest.php
index 01da1616d6e76..0b165efaa5165 100644
--- a/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesCommentsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesCommentsTest.php
@@ -49,8 +49,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageIssuesComments($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesEventsTest.php b/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesEventsTest.php
index f3b850ab04cd6..7db4e8491b22e 100644
--- a/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesEventsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesEventsTest.php
@@ -49,8 +49,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageIssuesEvents($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesLabelsTest.php b/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesLabelsTest.php
index 2ba6ac22c3395..b05afaa857208 100644
--- a/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesLabelsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesLabelsTest.php
@@ -49,8 +49,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageIssuesLabels($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesMilestonesTest.php b/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesMilestonesTest.php
index 69380f8c47778..94f1efa7f842e 100644
--- a/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesMilestonesTest.php
+++ b/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesMilestonesTest.php
@@ -60,7 +60,7 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
$this->object = new JGithubPackageIssuesMilestones($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/orgs/JGithubPackageOrgsMembersTest.php b/tests/unit/suites/libraries/joomla/github/orgs/JGithubPackageOrgsMembersTest.php
index 9bcd436a92ede..7e81a0aeec53b 100644
--- a/tests/unit/suites/libraries/joomla/github/orgs/JGithubPackageOrgsMembersTest.php
+++ b/tests/unit/suites/libraries/joomla/github/orgs/JGithubPackageOrgsMembersTest.php
@@ -52,8 +52,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageOrgsMembers($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/orgs/JGithubPackageOrgsTeamsTest.php b/tests/unit/suites/libraries/joomla/github/orgs/JGithubPackageOrgsTeamsTest.php
index 3a55d7fb01e98..ef220076cb700 100644
--- a/tests/unit/suites/libraries/joomla/github/orgs/JGithubPackageOrgsTeamsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/orgs/JGithubPackageOrgsTeamsTest.php
@@ -52,8 +52,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageOrgsTeams($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/pulls/JGithubPackagePullsCommentsTest.php b/tests/unit/suites/libraries/joomla/github/pulls/JGithubPackagePullsCommentsTest.php
index f7de1f374d995..86b2145fdd0e8 100644
--- a/tests/unit/suites/libraries/joomla/github/pulls/JGithubPackagePullsCommentsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/pulls/JGithubPackagePullsCommentsTest.php
@@ -48,8 +48,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackagePullsComments($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesCollaboratorsTest.php b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesCollaboratorsTest.php
index 4a48549b11870..5f98edb94d02b 100644
--- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesCollaboratorsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesCollaboratorsTest.php
@@ -52,8 +52,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageRepositoriesCollaborators($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesCommentsTest.php b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesCommentsTest.php
index 4908634ccd81b..d07730e5251f9 100644
--- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesCommentsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesCommentsTest.php
@@ -52,8 +52,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageRepositoriesComments($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesContentsTest.php b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesContentsTest.php
index 95c2ecbb54b72..5f902e129c5d8 100644
--- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesContentsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesContentsTest.php
@@ -52,8 +52,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageRepositoriesContents($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesDownloadsTest.php b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesDownloadsTest.php
index ba4763f355a58..3c343a83ae894 100644
--- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesDownloadsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesDownloadsTest.php
@@ -52,8 +52,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageRepositoriesDownloads($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesForksTest.php b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesForksTest.php
index f20155d0a4b02..19eaf30b32bdd 100644
--- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesForksTest.php
+++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesForksTest.php
@@ -64,7 +64,7 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
$this->object = new JGithubPackageRepositoriesForks($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesHooksTest.php b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesHooksTest.php
index 1114e79dbd30b..d756fc4b208f4 100644
--- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesHooksTest.php
+++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesHooksTest.php
@@ -65,8 +65,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageRepositoriesHooks($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesKeysTest.php b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesKeysTest.php
index e871159628e5e..ccc548576c0f4 100644
--- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesKeysTest.php
+++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesKeysTest.php
@@ -53,8 +53,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageRepositoriesKeys($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesMergingTest.php b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesMergingTest.php
index 57c36b3c1a7f3..c91b56d32f62b 100644
--- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesMergingTest.php
+++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesMergingTest.php
@@ -53,8 +53,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageRepositoriesMerging($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesStatusesTest.php b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesStatusesTest.php
index 4d01bc2f15d33..cc095e151e9ce 100644
--- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesStatusesTest.php
+++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesStatusesTest.php
@@ -60,7 +60,7 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
$this->object = new JGithubPackageRepositoriesStatuses($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersEmailsTest.php b/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersEmailsTest.php
index 6eff45d898eb5..92f0862df0b62 100644
--- a/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersEmailsTest.php
+++ b/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersEmailsTest.php
@@ -52,8 +52,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageUsersEmails($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersFollowersTest.php b/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersFollowersTest.php
index c8f770118d9d2..78f40d51adaf3 100644
--- a/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersFollowersTest.php
+++ b/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersFollowersTest.php
@@ -52,8 +52,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageUsersFollowers($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersKeysTest.php b/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersKeysTest.php
index d137c3ac5d07d..8019647f34f7c 100644
--- a/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersKeysTest.php
+++ b/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersKeysTest.php
@@ -52,8 +52,8 @@ protected function setUp()
parent::setUp();
$this->options = new JRegistry;
- $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put'));
- $this->response = $this->getMock('JHttpResponse');
+ $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+ $this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackageUsersKeys($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/google/JGoogleAuthOauth2Test.php b/tests/unit/suites/libraries/joomla/google/JGoogleAuthOauth2Test.php
index 716164db64203..f4f3b4b8bd2a5 100644
--- a/tests/unit/suites/libraries/joomla/google/JGoogleAuthOauth2Test.php
+++ b/tests/unit/suites/libraries/joomla/google/JGoogleAuthOauth2Test.php
@@ -77,7 +77,10 @@ protected function setUp()
$_SERVER['SCRIPT_NAME'] = '/index.php';
$this->options = new JRegistry;
- $this->http = $this->getMock('JHttp', array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'), array($this->options));
+ $this->http = $this->getMockBuilder('JHttp')
+ ->setMethods(array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'))
+ ->setConstructorArgs(array($this->options))
+ ->getMock();
$this->input = $this->getMockInput();
$mockApplication = $this->getMockWeb();
diff --git a/tests/unit/suites/libraries/joomla/google/JGoogleDataAdsenseTest.php b/tests/unit/suites/libraries/joomla/google/JGoogleDataAdsenseTest.php
index afdccf35d224c..ac9aca8a2af9b 100644
--- a/tests/unit/suites/libraries/joomla/google/JGoogleDataAdsenseTest.php
+++ b/tests/unit/suites/libraries/joomla/google/JGoogleDataAdsenseTest.php
@@ -69,7 +69,10 @@ protected function setUp()
$_SERVER['SCRIPT_NAME'] = '/index.php';
$this->options = new JRegistry;
- $this->http = $this->getMock('JHttp', array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'), array($this->options));
+ $this->http = $this->getMockBuilder('JHttp')
+ ->setMethods(array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'))
+ ->setConstructorArgs(array($this->options))
+ ->getMock();
$this->input = new JInput;
$this->oauth = new JOAuth2Client($this->options, $this->http, $this->input);
$this->auth = new JGoogleAuthOauth2($this->options, $this->oauth);
diff --git a/tests/unit/suites/libraries/joomla/google/JGoogleDataCalendarTest.php b/tests/unit/suites/libraries/joomla/google/JGoogleDataCalendarTest.php
index a046dc44dae6d..41cc4779a16e9 100644
--- a/tests/unit/suites/libraries/joomla/google/JGoogleDataCalendarTest.php
+++ b/tests/unit/suites/libraries/joomla/google/JGoogleDataCalendarTest.php
@@ -69,7 +69,10 @@ protected function setUp()
$_SERVER['SCRIPT_NAME'] = '/index.php';
$this->options = new JRegistry;
- $this->http = $this->getMock('JHttp', array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'), array($this->options));
+ $this->http = $this->getMockBuilder('JHttp')
+ ->setMethods(array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'))
+ ->setConstructorArgs(array($this->options))
+ ->getMock();
$this->input = new JInput;
$this->oauth = new JOAuth2Client($this->options, $this->http, $this->input);
$this->auth = new JGoogleAuthOauth2($this->options, $this->oauth);
diff --git a/tests/unit/suites/libraries/joomla/google/JGoogleDataPicasaAlbumTest.php b/tests/unit/suites/libraries/joomla/google/JGoogleDataPicasaAlbumTest.php
index dd7762911e425..82fdb43b1130f 100644
--- a/tests/unit/suites/libraries/joomla/google/JGoogleDataPicasaAlbumTest.php
+++ b/tests/unit/suites/libraries/joomla/google/JGoogleDataPicasaAlbumTest.php
@@ -73,7 +73,10 @@ protected function setUp()
$_SERVER['SCRIPT_NAME'] = '/index.php';
$this->options = new JRegistry;
- $this->http = $this->getMock('JHttp', array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'), array($this->options));
+ $this->http = $this->getMockBuilder('JHttp')
+ ->setMethods(array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'))
+ ->setConstructorArgs(array($this->options))
+ ->getMock();
$this->input = new JInput;
$this->oauth = new JOAuth2Client($this->options, $this->http, $this->input);
$this->auth = new JGoogleAuthOauth2($this->options, $this->oauth);
diff --git a/tests/unit/suites/libraries/joomla/google/JGoogleDataPicasaPhotoTest.php b/tests/unit/suites/libraries/joomla/google/JGoogleDataPicasaPhotoTest.php
index c7c492a3e5049..85f9bdad54d39 100644
--- a/tests/unit/suites/libraries/joomla/google/JGoogleDataPicasaPhotoTest.php
+++ b/tests/unit/suites/libraries/joomla/google/JGoogleDataPicasaPhotoTest.php
@@ -74,7 +74,10 @@ protected function setUp()
$_SERVER['SCRIPT_NAME'] = '/index.php';
$this->options = new JRegistry;
- $this->http = $this->getMock('JHttp', array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'), array($this->options));
+ $this->http = $this->getMockBuilder('JHttp')
+ ->setMethods(array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'))
+ ->setConstructorArgs(array($this->options))
+ ->getMock();
$this->input = new JInput;
$this->oauth = new JOAuth2Client($this->options, $this->http, $this->input);
$this->auth = new JGoogleAuthOauth2($this->options, $this->oauth);
diff --git a/tests/unit/suites/libraries/joomla/google/JGoogleDataPicasaTest.php b/tests/unit/suites/libraries/joomla/google/JGoogleDataPicasaTest.php
index d01da7b57c08f..2745c47c8e0e2 100644
--- a/tests/unit/suites/libraries/joomla/google/JGoogleDataPicasaTest.php
+++ b/tests/unit/suites/libraries/joomla/google/JGoogleDataPicasaTest.php
@@ -69,7 +69,10 @@ protected function setUp()
$_SERVER['SCRIPT_NAME'] = '/index.php';
$this->options = new JRegistry;
- $this->http = $this->getMock('JHttp', array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'), array($this->options));
+ $this->http = $this->getMockBuilder('JHttp')
+ ->setMethods(array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'))
+ ->setConstructorArgs(array($this->options))
+ ->getMock();
$this->input = new JInput;
$this->oauth = new JOAuth2Client($this->options, $this->http, $this->input);
$this->auth = new JGoogleAuthOauth2($this->options, $this->oauth);
diff --git a/tests/unit/suites/libraries/joomla/google/JGoogleDataPlusActivitiesTest.php b/tests/unit/suites/libraries/joomla/google/JGoogleDataPlusActivitiesTest.php
index d8a32f69ea8bc..0e2034529483c 100644
--- a/tests/unit/suites/libraries/joomla/google/JGoogleDataPlusActivitiesTest.php
+++ b/tests/unit/suites/libraries/joomla/google/JGoogleDataPlusActivitiesTest.php
@@ -81,7 +81,10 @@ protected function setUp()
$_SERVER['SCRIPT_NAME'] = '/index.php';
$this->options = new JRegistry;
- $this->http = $this->getMock('JHttp', array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'), array($this->options));
+ $this->http = $this->getMockBuilder('JHttp')
+ ->setMethods(array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'))
+ ->setConstructorArgs(array($this->options))
+ ->getMock();
$this->input = new JInput;
$this->oauth = new JOAuth2Client($this->options, $this->http, $this->input);
$this->auth = new JGoogleAuthOauth2($this->options, $this->oauth);
diff --git a/tests/unit/suites/libraries/joomla/google/JGoogleDataPlusCommentsTest.php b/tests/unit/suites/libraries/joomla/google/JGoogleDataPlusCommentsTest.php
index 47ff9a5504f27..160857c3f39fb 100644
--- a/tests/unit/suites/libraries/joomla/google/JGoogleDataPlusCommentsTest.php
+++ b/tests/unit/suites/libraries/joomla/google/JGoogleDataPlusCommentsTest.php
@@ -81,7 +81,10 @@ protected function setUp()
$_SERVER['SCRIPT_NAME'] = '/index.php';
$this->options = new JRegistry;
- $this->http = $this->getMock('JHttp', array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'), array($this->options));
+ $this->http = $this->getMockBuilder('JHttp')
+ ->setMethods(array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'))
+ ->setConstructorArgs(array($this->options))
+ ->getMock();
$this->input = new JInput;
$this->oauth = new JOAuth2Client($this->options, $this->http, $this->input);
$this->auth = new JGoogleAuthOauth2($this->options, $this->oauth);
diff --git a/tests/unit/suites/libraries/joomla/google/JGoogleDataPlusPeopleTest.php b/tests/unit/suites/libraries/joomla/google/JGoogleDataPlusPeopleTest.php
index 5418707442bfd..f831cd9e27a09 100644
--- a/tests/unit/suites/libraries/joomla/google/JGoogleDataPlusPeopleTest.php
+++ b/tests/unit/suites/libraries/joomla/google/JGoogleDataPlusPeopleTest.php
@@ -81,7 +81,10 @@ protected function setUp()
$_SERVER['SCRIPT_NAME'] = '/index.php';
$this->options = new JRegistry;
- $this->http = $this->getMock('JHttp', array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'), array($this->options));
+ $this->http = $this->getMockBuilder('JHttp')
+ ->setMethods(array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'))
+ ->setConstructorArgs(array($this->options))
+ ->getMock();
$this->input = new JInput;
$this->oauth = new JOAuth2Client($this->options, $this->http, $this->input);
$this->auth = new JGoogleAuthOauth2($this->options, $this->oauth);
diff --git a/tests/unit/suites/libraries/joomla/google/JGoogleDataPlusTest.php b/tests/unit/suites/libraries/joomla/google/JGoogleDataPlusTest.php
index 4597d33c42d18..3100f35adcc62 100644
--- a/tests/unit/suites/libraries/joomla/google/JGoogleDataPlusTest.php
+++ b/tests/unit/suites/libraries/joomla/google/JGoogleDataPlusTest.php
@@ -69,7 +69,10 @@ protected function setUp()
$_SERVER['SCRIPT_NAME'] = '/index.php';
$this->options = new JRegistry;
- $this->http = $this->getMock('JHttp', array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'), array($this->options));
+ $this->http = $this->getMockBuilder('JHttp')
+ ->setMethods(array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'))
+ ->setConstructorArgs(array($this->options))
+ ->getMock();
$this->input = new JInput;
$this->oauth = new JOAuth2Client($this->options, $this->http, $this->input);
$this->auth = new JGoogleAuthOauth2($this->options, $this->oauth);
diff --git a/tests/unit/suites/libraries/joomla/google/JGoogleEmbedMapsTest.php b/tests/unit/suites/libraries/joomla/google/JGoogleEmbedMapsTest.php
index 734b212b11be9..24043b76b5244 100644
--- a/tests/unit/suites/libraries/joomla/google/JGoogleEmbedMapsTest.php
+++ b/tests/unit/suites/libraries/joomla/google/JGoogleEmbedMapsTest.php
@@ -48,7 +48,10 @@ protected function setUp()
$this->options = new JRegistry;
- $this->http = $this->getMock('JHttp', array('get'), array($this->options));
+ $this->http = $this->getMockBuilder('JHttp')
+ ->setMethods(array('get'))
+ ->setConstructorArgs(array($this->options))
+ ->getMock();
$this->uri = new JUri;
$this->object = new JGoogleEmbedMaps($this->options, $this->uri, $this->http);
}
diff --git a/tests/unit/suites/libraries/joomla/google/JGoogleTest.php b/tests/unit/suites/libraries/joomla/google/JGoogleTest.php
index afd4bafa65ff8..217dca4f5a3ce 100644
--- a/tests/unit/suites/libraries/joomla/google/JGoogleTest.php
+++ b/tests/unit/suites/libraries/joomla/google/JGoogleTest.php
@@ -69,7 +69,10 @@ protected function setUp()
$_SERVER['SCRIPT_NAME'] = '/index.php';
$this->options = new JRegistry;
- $this->http = $this->getMock('JHttp', array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'), array($this->options));
+ $this->http = $this->getMockBuilder('JHttp')
+ ->setMethods(array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'))
+ ->setConstructorArgs(array($this->options))
+ ->getMock();
$this->input = new JInput;
$this->oauth = new JOAuth2Client($this->options, $this->http, $this->input);
$this->auth = new JGoogleAuthOauth2($this->options, $this->oauth);
diff --git a/tests/unit/suites/libraries/joomla/http/JHttpTest.php b/tests/unit/suites/libraries/joomla/http/JHttpTest.php
index ad3b4df5b0c0e..48b3242da6629 100644
--- a/tests/unit/suites/libraries/joomla/http/JHttpTest.php
+++ b/tests/unit/suites/libraries/joomla/http/JHttpTest.php
@@ -47,9 +47,18 @@ protected function setUp()
parent::setUp();
static $classNumber = 1;
- $this->options = $this->getMock('\\Joomla\\Registry\\Registry', array('get', 'set'));
- $this->transport = $this->getMock('JHttpTransportStream', array('request'), array($this->options), 'CustomTransport' . $classNumber ++, false);
+ // Build the mock object.
+ $this->options = $this->getMockBuilder('\\Joomla\\Registry\\Registry')
+ ->setMethods(array('get', 'set'))
+ ->getMock();
+
+ $this->transport = $this->getMockBuilder('JHttpTransportStream')
+ ->setMethods(array('request'))
+ ->setConstructorArgs(array($this->options))
+ ->setMockClassName('CustomTransport' . $classNumber ++)
+ ->disableOriginalConstructor()
+ ->getMock();
$this->object = new JHttp($this->options, $this->transport);
}
diff --git a/tests/unit/suites/libraries/joomla/http/JHttpTransportTest.php b/tests/unit/suites/libraries/joomla/http/JHttpTransportTest.php
index ecd1560e825cf..254a2c9ceec1e 100644
--- a/tests/unit/suites/libraries/joomla/http/JHttpTransportTest.php
+++ b/tests/unit/suites/libraries/joomla/http/JHttpTransportTest.php
@@ -45,7 +45,7 @@ protected function setUp()
else
{
parent::setUp();
- $this->options = $this->getMock('\\Joomla\\Registry\\Registry', array('get', 'set'));
+ $this->options = $this->getMockBuilder('\\Joomla\\Registry\\Registry')->setMethods(array('get', 'set'))->getMock();
$this->stubUrl = defined('JTEST_HTTP_STUB') ? JTEST_HTTP_STUB : getenv('JTEST_HTTP_STUB');
}
}
diff --git a/tests/unit/suites/libraries/joomla/linkedin/JLinkedinCommunicationsTest.php b/tests/unit/suites/libraries/joomla/linkedin/JLinkedinCommunicationsTest.php
index 82e1ba7f97cc6..b1c95d276a0bd 100644
--- a/tests/unit/suites/libraries/joomla/linkedin/JLinkedinCommunicationsTest.php
+++ b/tests/unit/suites/libraries/joomla/linkedin/JLinkedinCommunicationsTest.php
@@ -88,7 +88,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JLinkedinOauth($this->options, $this->client, $this->input);
$this->oauth->setToken(array('key' => $key, 'secret' => $secret));
diff --git a/tests/unit/suites/libraries/joomla/linkedin/JLinkedinCompaniesTest.php b/tests/unit/suites/libraries/joomla/linkedin/JLinkedinCompaniesTest.php
index 1d0c6b22ea6aa..28e814face59e 100644
--- a/tests/unit/suites/libraries/joomla/linkedin/JLinkedinCompaniesTest.php
+++ b/tests/unit/suites/libraries/joomla/linkedin/JLinkedinCompaniesTest.php
@@ -87,7 +87,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JLinkedinOauth($this->options, $this->client, $this->input);
$this->oauth->setToken(array('key' => $key, 'secret' => $secret));
diff --git a/tests/unit/suites/libraries/joomla/linkedin/JLinkedinGroupsTest.php b/tests/unit/suites/libraries/joomla/linkedin/JLinkedinGroupsTest.php
index 353e10b92d1fe..c1779518b1a05 100644
--- a/tests/unit/suites/libraries/joomla/linkedin/JLinkedinGroupsTest.php
+++ b/tests/unit/suites/libraries/joomla/linkedin/JLinkedinGroupsTest.php
@@ -87,7 +87,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JLinkedinOauth($this->options, $this->client, $this->input);
$this->oauth->setToken(array('key' => $key, 'secret' => $secret));
diff --git a/tests/unit/suites/libraries/joomla/linkedin/JLinkedinJobsTest.php b/tests/unit/suites/libraries/joomla/linkedin/JLinkedinJobsTest.php
index 2803d91e5626b..f092304b64152 100644
--- a/tests/unit/suites/libraries/joomla/linkedin/JLinkedinJobsTest.php
+++ b/tests/unit/suites/libraries/joomla/linkedin/JLinkedinJobsTest.php
@@ -87,7 +87,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JLinkedinOauth($this->options, $this->client, $this->input);
$this->oauth->setToken(array('key' => $key, 'secret' => $secret));
diff --git a/tests/unit/suites/libraries/joomla/linkedin/JLinkedinOAuthTest.php b/tests/unit/suites/libraries/joomla/linkedin/JLinkedinOAuthTest.php
index 3aa286eade318..4da462ec17d08 100644
--- a/tests/unit/suites/libraries/joomla/linkedin/JLinkedinOAuthTest.php
+++ b/tests/unit/suites/libraries/joomla/linkedin/JLinkedinOAuthTest.php
@@ -81,7 +81,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->options->set('consumer_key', $key);
$this->options->set('consumer_secret', $secret);
diff --git a/tests/unit/suites/libraries/joomla/linkedin/JLinkedinObjectTest.php b/tests/unit/suites/libraries/joomla/linkedin/JLinkedinObjectTest.php
index bac7baee99cca..33686774ba327 100644
--- a/tests/unit/suites/libraries/joomla/linkedin/JLinkedinObjectTest.php
+++ b/tests/unit/suites/libraries/joomla/linkedin/JLinkedinObjectTest.php
@@ -60,7 +60,7 @@ class JLinkedinObjectTest extends TestCase
protected function setUp()
{
$this->options = new JRegistry;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->object = new JLinkedinObjectMock($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/linkedin/JLinkedinPeopleTest.php b/tests/unit/suites/libraries/joomla/linkedin/JLinkedinPeopleTest.php
index ff211d80a5b32..e1ba64d40a976 100644
--- a/tests/unit/suites/libraries/joomla/linkedin/JLinkedinPeopleTest.php
+++ b/tests/unit/suites/libraries/joomla/linkedin/JLinkedinPeopleTest.php
@@ -94,7 +94,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JLinkedinOauth($this->options, $this->client, $this->input);
$this->oauth->setToken(array('key' => $key, 'secret' => $secret));
diff --git a/tests/unit/suites/libraries/joomla/linkedin/JLinkedinStreamTest.php b/tests/unit/suites/libraries/joomla/linkedin/JLinkedinStreamTest.php
index 1d70ad15fe7d0..846f2422883e9 100644
--- a/tests/unit/suites/libraries/joomla/linkedin/JLinkedinStreamTest.php
+++ b/tests/unit/suites/libraries/joomla/linkedin/JLinkedinStreamTest.php
@@ -87,7 +87,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JLinkedinOauth($this->options, $this->client, $this->input);
$this->oauth->setToken(array('key' => $key, 'secret' => $secret));
diff --git a/tests/unit/suites/libraries/joomla/linkedin/JLinkedinTest.php b/tests/unit/suites/libraries/joomla/linkedin/JLinkedinTest.php
index a17e7cc82a1b0..2cc5e820ee718 100644
--- a/tests/unit/suites/libraries/joomla/linkedin/JLinkedinTest.php
+++ b/tests/unit/suites/libraries/joomla/linkedin/JLinkedinTest.php
@@ -63,7 +63,7 @@ protected function setUp()
$_SERVER['SCRIPT_NAME'] = '/index.php';
$this->options = new JRegistry;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->object = new JLinkedin($this->oauth, $this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/mail/JMailTest.php b/tests/unit/suites/libraries/joomla/mail/JMailTest.php
index 49455a79d70e3..aed83dc1e61de 100644
--- a/tests/unit/suites/libraries/joomla/mail/JMailTest.php
+++ b/tests/unit/suites/libraries/joomla/mail/JMailTest.php
@@ -277,8 +277,10 @@ public function dataUseSmtp()
*/
public function testUseSmtp($auth, $host, $user, $pass, $secure, $port, $expected)
{
- $mail = $this->getMock('JMail', array('SetLanguage', 'IsSMTP', 'IsMail'));
-
+ // Build the mock object.
+ $mail = $this->getMockBuilder('JMail')
+ ->setMethods(array('SetLanguage', 'IsSMTP', 'IsMail'))
+ ->getMock();
$mail->expects(
$this->once()
)
diff --git a/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiCategoriesTest.php b/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiCategoriesTest.php
index 1117cab06e552..3f84fc859241d 100644
--- a/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiCategoriesTest.php
+++ b/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiCategoriesTest.php
@@ -1,213 +1,213 @@
-';
-
- /**
- * @var string Sample xml error message.
- * @since 12.3
- */
- protected $errorString = 'Generic Error';
-
- /**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- *
- * @access protected
- *
- * @return void
- */
- protected function setUp()
- {
- $this->options = new JRegistry;
- $this->client = $this->getMock('JMediawikiHttp', array('get', 'post', 'delete', 'patch', 'put'));
-
- $this->object = new JMediawikiCategories($this->options, $this->client);
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- *
- * @return void
- *
- * @see PHPUnit_Framework_TestCase::tearDown()
- * @since 3.6
- */
- protected function tearDown()
- {
- unset($this->options);
- unset($this->client);
- unset($this->object);
- }
-
- /**
- * Tests the getCategories method
- *
- * @return void
- */
- public function testGetCategories()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&prop=categories&titles=Main Page&format=xml')
- ->will($this->returnValue($returnData));
-
- $this->assertThat(
- $this->object->getCategories(array('Main Page')),
- $this->equalTo(simplexml_load_string($this->sampleString))
- );
- }
-
- /**
- * Tests the getCategoriesUsed method
- *
- * @return void
- */
- public function testGetCategoriesUsed()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&generator=categories&prop=info&titles=Main Page&format=xml')
- ->will($this->returnValue($returnData));
-
- $this->assertThat(
- $this->object->getCategoriesUsed(array('Main Page')),
- $this->equalTo(simplexml_load_string($this->sampleString))
- );
- }
-
- /**
- * Tests the getCategoriesInfo method
- *
- * @return void
- */
- public function testGetCategoriesInfo()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&prop=categoryinfo&titles=Main Page&format=xml')
- ->will($this->returnValue($returnData));
-
- $this->assertThat(
- $this->object->getCategoriesInfo(array('Main Page')),
- $this->equalTo(simplexml_load_string($this->sampleString))
- );
- }
-
- /**
- * Tests the getCategoryMembers method
- *
- * @return void
- */
- public function testGetCategoryMembers()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&list=categorymembers&cmtitle=Category:Help&format=xml')
- ->will($this->returnValue($returnData));
-
- $this->assertThat(
- $this->object->getCategoryMembers('Category:Help'),
- $this->equalTo(simplexml_load_string($this->sampleString))
- );
- }
-
- /**
- * Tests the enumerateCategories method
- *
- * @return void
- */
- public function testEnumerateCategories()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&list=allcategories&format=xml')
- ->will($this->returnValue($returnData));
-
- $this->assertThat(
- $this->object->enumerateCategories(),
- $this->equalTo(simplexml_load_string($this->sampleString))
- );
- }
-
- /**
- * Tests the getChangeTags method
- *
- * @return void
- */
- public function testGetChangeTags()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&list=tags&format=xml')
- ->will($this->returnValue($returnData));
-
- $this->assertThat(
- $this->object->getChangeTags(),
- $this->equalTo(simplexml_load_string($this->sampleString))
- );
- }
-}
+';
+
+ /**
+ * @var string Sample xml error message.
+ * @since 12.3
+ */
+ protected $errorString = 'Generic Error';
+
+ /**
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test is executed.
+ *
+ * @access protected
+ *
+ * @return void
+ */
+ protected function setUp()
+ {
+ $this->options = new JRegistry;
+ $this->client = $this->getMockBuilder('JMediawikiHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+
+ $this->object = new JMediawikiCategories($this->options, $this->client);
+ }
+
+ /**
+ * Tears down the fixture, for example, closes a network connection.
+ * This method is called after a test is executed.
+ *
+ * @return void
+ *
+ * @see PHPUnit_Framework_TestCase::tearDown()
+ * @since 3.6
+ */
+ protected function tearDown()
+ {
+ unset($this->options);
+ unset($this->client);
+ unset($this->object);
+ }
+
+ /**
+ * Tests the getCategories method
+ *
+ * @return void
+ */
+ public function testGetCategories()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&prop=categories&titles=Main Page&format=xml')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->getCategories(array('Main Page')),
+ $this->equalTo(simplexml_load_string($this->sampleString))
+ );
+ }
+
+ /**
+ * Tests the getCategoriesUsed method
+ *
+ * @return void
+ */
+ public function testGetCategoriesUsed()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&generator=categories&prop=info&titles=Main Page&format=xml')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->getCategoriesUsed(array('Main Page')),
+ $this->equalTo(simplexml_load_string($this->sampleString))
+ );
+ }
+
+ /**
+ * Tests the getCategoriesInfo method
+ *
+ * @return void
+ */
+ public function testGetCategoriesInfo()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&prop=categoryinfo&titles=Main Page&format=xml')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->getCategoriesInfo(array('Main Page')),
+ $this->equalTo(simplexml_load_string($this->sampleString))
+ );
+ }
+
+ /**
+ * Tests the getCategoryMembers method
+ *
+ * @return void
+ */
+ public function testGetCategoryMembers()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&list=categorymembers&cmtitle=Category:Help&format=xml')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->getCategoryMembers('Category:Help'),
+ $this->equalTo(simplexml_load_string($this->sampleString))
+ );
+ }
+
+ /**
+ * Tests the enumerateCategories method
+ *
+ * @return void
+ */
+ public function testEnumerateCategories()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&list=allcategories&format=xml')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->enumerateCategories(),
+ $this->equalTo(simplexml_load_string($this->sampleString))
+ );
+ }
+
+ /**
+ * Tests the getChangeTags method
+ *
+ * @return void
+ */
+ public function testGetChangeTags()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&list=tags&format=xml')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->getChangeTags(),
+ $this->equalTo(simplexml_load_string($this->sampleString))
+ );
+ }
+}
diff --git a/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiHttpTest.php b/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiHttpTest.php
index f24eab2f3780b..9b28a74ae7e53 100644
--- a/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiHttpTest.php
+++ b/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiHttpTest.php
@@ -1,121 +1,126 @@
-';
-
- /**
- * @var string Sample xml error message.
- * @since 12.3
- */
- protected $errorString = 'Generic Error';
-
- /**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- *
- * @access protected
- *
- * @return void
- */
- protected function setUp()
- {
- $this->options = new JRegistry;
- $this->transport = $this->getMock('JHttpTransportStream', array('request'), array($this->options), 'CustomTransport', false);
-
- $this->object = new JMediawikiHttp($this->options, $this->transport);
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- *
- * @return void
- *
- * @see PHPUnit_Framework_TestCase::tearDown()
- * @since 3.6
- */
- protected function tearDown()
- {
- unset($this->options);
- unset($this->transport);
- unset($this->object);
- }
-
- /**
- * Tests the get method
- *
- * @return void
- */
- public function testGet()
- {
- $uri = new JUri('https://example.com/gettest');
-
- $this->transport->expects($this->once())
- ->method('request')
- ->with('GET', $uri)
- ->will($this->returnValue('requestResponse'));
-
- $this->assertThat(
- $this->object->get('https://example.com/gettest'),
- $this->equalTo('requestResponse')
- );
- }
-
- /**
- * Tests the post method
- *
- * @return void
- */
- public function testPost()
- {
- $uri = new JUri('https://example.com/gettest');
-
- $this->transport->expects($this->once())
- ->method('request')
- ->with('POST', $uri, array())
- ->will($this->returnValue('requestResponse'));
-
- $this->assertThat(
- $this->object->post('https://example.com/gettest', array()),
- $this->equalTo('requestResponse')
- );
- }
-}
+';
+
+ /**
+ * @var string Sample xml error message.
+ * @since 12.3
+ */
+ protected $errorString = 'Generic Error';
+
+ /**
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test is executed.
+ *
+ * @access protected
+ *
+ * @return void
+ */
+ protected function setUp()
+ {
+ $this->options = new JRegistry;
+ $this->transport = $this->getMockBuilder('JHttpTransportStream')
+ ->setMethods(array('request'))
+ ->setConstructorArgs(array($this->options))
+ ->setMockClassName('CustomTransport')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->object = new JMediawikiHttp($this->options, $this->transport);
+ }
+
+ /**
+ * Tears down the fixture, for example, closes a network connection.
+ * This method is called after a test is executed.
+ *
+ * @return void
+ *
+ * @see PHPUnit_Framework_TestCase::tearDown()
+ * @since 3.6
+ */
+ protected function tearDown()
+ {
+ unset($this->options);
+ unset($this->transport);
+ unset($this->object);
+ }
+
+ /**
+ * Tests the get method
+ *
+ * @return void
+ */
+ public function testGet()
+ {
+ $uri = new JUri('https://example.com/gettest');
+
+ $this->transport->expects($this->once())
+ ->method('request')
+ ->with('GET', $uri)
+ ->will($this->returnValue('requestResponse'));
+
+ $this->assertThat(
+ $this->object->get('https://example.com/gettest'),
+ $this->equalTo('requestResponse')
+ );
+ }
+
+ /**
+ * Tests the post method
+ *
+ * @return void
+ */
+ public function testPost()
+ {
+ $uri = new JUri('https://example.com/gettest');
+
+ $this->transport->expects($this->once())
+ ->method('request')
+ ->with('POST', $uri, array())
+ ->will($this->returnValue('requestResponse'));
+
+ $this->assertThat(
+ $this->object->post('https://example.com/gettest', array()),
+ $this->equalTo('requestResponse')
+ );
+ }
+}
diff --git a/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiImagesTest.php b/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiImagesTest.php
index f0698a9352360..8042ce2a8e42f 100644
--- a/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiImagesTest.php
+++ b/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiImagesTest.php
@@ -1,169 +1,169 @@
-';
-
- /**
- * @var string Sample xml error message.
- * @since 12.3
- */
- protected $errorString = 'Generic Error';
-
- /**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- *
- * @access protected
- *
- * @return void
- */
- protected function setUp()
- {
- $this->options = new JRegistry;
- $this->client = $this->getMock('JMediawikiHttp', array('get', 'post', 'delete', 'patch', 'put'));
-
- $this->object = new JMediawikiImages($this->options, $this->client);
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- *
- * @return void
- *
- * @see PHPUnit_Framework_TestCase::tearDown()
- * @since 3.6
- */
- protected function tearDown()
- {
- unset($this->options);
- unset($this->client);
- unset($this->object);
- }
-
- /**
- * Tests the getImages method
- *
- * @return void
- */
- public function testGetImages()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&prop=images&titles=Main Page&format=xml')
- ->will($this->returnValue($returnData));
-
- $this->assertThat(
- $this->object->getImages(array('Main Page')),
- $this->equalTo(simplexml_load_string($this->sampleString))
- );
- }
-
- /**
- * Tests the getImagesUsed method
- *
- * @return void
- */
- public function testGetImagesUsed()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&generator=images&prop=info&titles=Main Page&format=xml')
- ->will($this->returnValue($returnData));
-
- $this->assertThat(
- $this->object->getImagesUsed(array('Main Page')),
- $this->equalTo(simplexml_load_string($this->sampleString))
- );
- }
-
- /**
- * Tests the getImageInfo method
- *
- * @return void
- */
- public function testGetImageInfo()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&prop=imageinfo&format=xml')
- ->will($this->returnValue($returnData));
-
- $this->assertThat(
- $this->object->getImageInfo(),
- $this->equalTo(simplexml_load_string($this->sampleString))
- );
- }
-
- /**
- * Tests the enumerateImages method
- *
- * @return void
- */
- public function testEnumerateImages()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&list=allimages&format=xml')
- ->will($this->returnValue($returnData));
-
- $this->assertThat(
- $this->object->enumerateImages(),
- $this->equalTo(simplexml_load_string($this->sampleString))
- );
- }
-}
+';
+
+ /**
+ * @var string Sample xml error message.
+ * @since 12.3
+ */
+ protected $errorString = 'Generic Error';
+
+ /**
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test is executed.
+ *
+ * @access protected
+ *
+ * @return void
+ */
+ protected function setUp()
+ {
+ $this->options = new JRegistry;
+ $this->client = $this->getMockBuilder('JMediawikiHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+
+ $this->object = new JMediawikiImages($this->options, $this->client);
+ }
+
+ /**
+ * Tears down the fixture, for example, closes a network connection.
+ * This method is called after a test is executed.
+ *
+ * @return void
+ *
+ * @see PHPUnit_Framework_TestCase::tearDown()
+ * @since 3.6
+ */
+ protected function tearDown()
+ {
+ unset($this->options);
+ unset($this->client);
+ unset($this->object);
+ }
+
+ /**
+ * Tests the getImages method
+ *
+ * @return void
+ */
+ public function testGetImages()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&prop=images&titles=Main Page&format=xml')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->getImages(array('Main Page')),
+ $this->equalTo(simplexml_load_string($this->sampleString))
+ );
+ }
+
+ /**
+ * Tests the getImagesUsed method
+ *
+ * @return void
+ */
+ public function testGetImagesUsed()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&generator=images&prop=info&titles=Main Page&format=xml')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->getImagesUsed(array('Main Page')),
+ $this->equalTo(simplexml_load_string($this->sampleString))
+ );
+ }
+
+ /**
+ * Tests the getImageInfo method
+ *
+ * @return void
+ */
+ public function testGetImageInfo()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&prop=imageinfo&format=xml')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->getImageInfo(),
+ $this->equalTo(simplexml_load_string($this->sampleString))
+ );
+ }
+
+ /**
+ * Tests the enumerateImages method
+ *
+ * @return void
+ */
+ public function testEnumerateImages()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&list=allimages&format=xml')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->enumerateImages(),
+ $this->equalTo(simplexml_load_string($this->sampleString))
+ );
+ }
+}
diff --git a/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiLinksTest.php b/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiLinksTest.php
index 3ef71ff317413..e682c2c006e13 100644
--- a/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiLinksTest.php
+++ b/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiLinksTest.php
@@ -1,213 +1,213 @@
-';
-
- /**
- * @var string Sample xml error message.
- * @since 12.3
- */
- protected $errorString = 'Generic Error';
-
- /**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- *
- * @access protected
- *
- * @return void
- */
- protected function setUp()
- {
- $this->options = new JRegistry;
- $this->client = $this->getMock('JMediawikiHttp', array('get', 'post', 'delete', 'patch', 'put'));
-
- $this->object = new JMediawikiLinks($this->options, $this->client);
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- *
- * @return void
- *
- * @see PHPUnit_Framework_TestCase::tearDown()
- * @since 3.6
- */
- protected function tearDown()
- {
- unset($this->options);
- unset($this->client);
- unset($this->object);
- }
-
- /**
- * Tests the getCategories method
- *
- * @return void
- */
- public function testGetLinks()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&prop=links&titles=Main Page&format=xml')
- ->will($this->returnValue($returnData));
-
- $this->assertThat(
- $this->object->getLinks(array('Main Page')),
- $this->equalTo(simplexml_load_string($this->sampleString))
- );
- }
-
- /**
- * Tests the getCategories method
- *
- * @return void
- */
- public function testGetLinksUsed()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&generator=links&prop=info&titles=Main Page&format=xml')
- ->will($this->returnValue($returnData));
-
- $this->assertThat(
- $this->object->getLinksUsed(array('Main Page')),
- $this->equalTo(simplexml_load_string($this->sampleString))
- );
- }
-
- /**
- * Tests the getCategories method
- *
- * @return void
- */
- public function testGetIWLinks()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&prop=links&titles=Main Page&format=xml')
- ->will($this->returnValue($returnData));
-
- $this->assertThat(
- $this->object->getIWLinks(array('Main Page')),
- $this->equalTo(simplexml_load_string($this->sampleString))
- );
- }
-
- /**
- * Tests the getCategories method
- *
- * @return void
- */
- public function testGetLangLinks()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&prop=langlinks&titles=Main Page&format=xml')
- ->will($this->returnValue($returnData));
-
- $this->assertThat(
- $this->object->getLangLinks(array('Main Page')),
- $this->equalTo(simplexml_load_string($this->sampleString))
- );
- }
-
- /**
- * Tests the getCategories method
- *
- * @return void
- */
- public function testGetExtLinks()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&prop=extlinks&titles=Main Page&format=xml')
- ->will($this->returnValue($returnData));
-
- $this->assertThat(
- $this->object->getExtLinks(array('Main Page')),
- $this->equalTo(simplexml_load_string($this->sampleString))
- );
- }
-
- /**
- * Tests the getCategories method
- *
- * @return void
- */
- public function testEnumerateLinks()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&meta=siteinfo&alcontinue=&format=xml')
- ->will($this->returnValue($returnData));
-
- $this->assertThat(
- $this->object->enumerateLinks(array('Main Page')),
- $this->equalTo(simplexml_load_string($this->sampleString))
- );
- }
-}
+';
+
+ /**
+ * @var string Sample xml error message.
+ * @since 12.3
+ */
+ protected $errorString = 'Generic Error';
+
+ /**
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test is executed.
+ *
+ * @access protected
+ *
+ * @return void
+ */
+ protected function setUp()
+ {
+ $this->options = new JRegistry;
+ $this->client = $this->getMockBuilder('JMediawikiHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+
+ $this->object = new JMediawikiLinks($this->options, $this->client);
+ }
+
+ /**
+ * Tears down the fixture, for example, closes a network connection.
+ * This method is called after a test is executed.
+ *
+ * @return void
+ *
+ * @see PHPUnit_Framework_TestCase::tearDown()
+ * @since 3.6
+ */
+ protected function tearDown()
+ {
+ unset($this->options);
+ unset($this->client);
+ unset($this->object);
+ }
+
+ /**
+ * Tests the getCategories method
+ *
+ * @return void
+ */
+ public function testGetLinks()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&prop=links&titles=Main Page&format=xml')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->getLinks(array('Main Page')),
+ $this->equalTo(simplexml_load_string($this->sampleString))
+ );
+ }
+
+ /**
+ * Tests the getCategories method
+ *
+ * @return void
+ */
+ public function testGetLinksUsed()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&generator=links&prop=info&titles=Main Page&format=xml')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->getLinksUsed(array('Main Page')),
+ $this->equalTo(simplexml_load_string($this->sampleString))
+ );
+ }
+
+ /**
+ * Tests the getCategories method
+ *
+ * @return void
+ */
+ public function testGetIWLinks()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&prop=links&titles=Main Page&format=xml')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->getIWLinks(array('Main Page')),
+ $this->equalTo(simplexml_load_string($this->sampleString))
+ );
+ }
+
+ /**
+ * Tests the getCategories method
+ *
+ * @return void
+ */
+ public function testGetLangLinks()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&prop=langlinks&titles=Main Page&format=xml')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->getLangLinks(array('Main Page')),
+ $this->equalTo(simplexml_load_string($this->sampleString))
+ );
+ }
+
+ /**
+ * Tests the getCategories method
+ *
+ * @return void
+ */
+ public function testGetExtLinks()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&prop=extlinks&titles=Main Page&format=xml')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->getExtLinks(array('Main Page')),
+ $this->equalTo(simplexml_load_string($this->sampleString))
+ );
+ }
+
+ /**
+ * Tests the getCategories method
+ *
+ * @return void
+ */
+ public function testEnumerateLinks()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&meta=siteinfo&alcontinue=&format=xml')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->enumerateLinks(array('Main Page')),
+ $this->equalTo(simplexml_load_string($this->sampleString))
+ );
+ }
+}
diff --git a/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiObjectTest.php b/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiObjectTest.php
index 8be25297c7585..6dec0eea9c15a 100644
--- a/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiObjectTest.php
+++ b/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiObjectTest.php
@@ -1,97 +1,97 @@
-';
-
- /**
- * @var string Sample xml error message.
- * @since 12.3
- */
- protected $errorString = 'Generic Error';
-
- /**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- *
- * @access protected
- *
- * @return void
- */
- protected function setUp()
- {
- $this->options = new JRegistry;
- $this->client = $this->getMock('JMediawikiHttp', array('get', 'post', 'delete', 'patch', 'put'));
-
- $this->object = new JMediawikiObjectMock($this->options, $this->client);
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- *
- * @return void
- *
- * @see PHPUnit_Framework_TestCase::tearDown()
- * @since 3.6
- */
- protected function tearDown()
- {
- unset($this->options);
- unset($this->client);
- unset($this->object);
- }
-
- /**
- * Tests the buildParameter method
- *
- * @return void
- */
- public function testBuildParameter()
- {
- $this->assertThat(
- $this->object->buildParameter(array('Joomla', 'Joomla', 'Joomla')),
- $this->equalTo('Joomla|Joomla|Joomla')
- );
- }
-
-}
+';
+
+ /**
+ * @var string Sample xml error message.
+ * @since 12.3
+ */
+ protected $errorString = 'Generic Error';
+
+ /**
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test is executed.
+ *
+ * @access protected
+ *
+ * @return void
+ */
+ protected function setUp()
+ {
+ $this->options = new JRegistry;
+ $this->client = $this->getMockBuilder('JMediawikiHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+
+ $this->object = new JMediawikiObjectMock($this->options, $this->client);
+ }
+
+ /**
+ * Tears down the fixture, for example, closes a network connection.
+ * This method is called after a test is executed.
+ *
+ * @return void
+ *
+ * @see PHPUnit_Framework_TestCase::tearDown()
+ * @since 3.6
+ */
+ protected function tearDown()
+ {
+ unset($this->options);
+ unset($this->client);
+ unset($this->object);
+ }
+
+ /**
+ * Tests the buildParameter method
+ *
+ * @return void
+ */
+ public function testBuildParameter()
+ {
+ $this->assertThat(
+ $this->object->buildParameter(array('Joomla', 'Joomla', 'Joomla')),
+ $this->equalTo('Joomla|Joomla|Joomla')
+ );
+ }
+
+}
diff --git a/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiPagesTest.php b/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiPagesTest.php
index 4d9008e55c089..8c7d2d3cdf517 100644
--- a/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiPagesTest.php
+++ b/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiPagesTest.php
@@ -1,160 +1,160 @@
-';
-
- /**
- * @var string Sample xml error message.
- */
- protected $errorString = 'Generic Error';
-
- /**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- *
- * @return void
- */
- protected function setUp()
- {
- $this->options = new JRegistry;
- $this->client = $this->getMock('JMediawikiHttp', array('get', 'post', 'delete', 'patch', 'put'));
-
- $this->object = new JMediawikiPages(
- $this->options,
- $this->client
- );
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- *
- * @return void
- *
- * @see PHPUnit_Framework_TestCase::tearDown()
- * @since 3.6
- */
- protected function tearDown()
- {
- unset($this->options);
- unset($this->client);
- unset($this->object);
- }
-
- /**
- * Tests the getPageInfo method
- */
- public function testGetPageInfo()
- {
- $returnData = $this->getReturnData();
-
- $this->client
- ->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&prop=info&titles=Main Page&format=xml')
- ->willReturn($returnData);
-
- $this->assertEquals(
- simplexml_load_string($this->sampleString),
- $this->object->getPageInfo(array('Main Page'))
- );
- }
-
- /**
- * Tests the getPageProperties method
- */
- public function testGetPageProperties()
- {
- $returnData = $this->getReturnData();
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&prop=pageprops&titles=Main Page&format=xml')
- ->willReturn($returnData);
-
- $this->assertEquals(
- simplexml_load_string($this->sampleString),
- $this->object->getPageProperties(array('Main Page'))
- );
- }
-
- /**
- * Tests the getBackLinks method
- */
- public function testGetBackLinks()
- {
- $returnData = $this->getReturnData();
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&list=backlinks&bltitle=Joomla&format=xml')
- ->willReturn($returnData);
-
- $this->assertEquals(
- simplexml_load_string($this->sampleString),
- $this->object->getBackLinks('Joomla')
- );
- }
-
- /**
- * Tests the getIWBackLinks method
- */
- public function testGetIWBackLinks()
- {
- $returnData = $this->getReturnData();
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&list=iwbacklinks&iwbltitle=Joomla&format=xml')
- ->willReturn($returnData);
-
- $this->assertEquals(
- simplexml_load_string($this->sampleString),
- $this->object->getIWBackLinks('Joomla')
- );
- }
-
- /**
- * @return stdClass
- */
- private function getReturnData()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- return $returnData;
- }
-}
+';
+
+ /**
+ * @var string Sample xml error message.
+ */
+ protected $errorString = 'Generic Error';
+
+ /**
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test is executed.
+ *
+ * @return void
+ */
+ protected function setUp()
+ {
+ $this->options = new JRegistry;
+ $this->client = $this->getMockBuilder('JMediawikiHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+
+ $this->object = new JMediawikiPages(
+ $this->options,
+ $this->client
+ );
+ }
+
+ /**
+ * Tears down the fixture, for example, closes a network connection.
+ * This method is called after a test is executed.
+ *
+ * @return void
+ *
+ * @see PHPUnit_Framework_TestCase::tearDown()
+ * @since 3.6
+ */
+ protected function tearDown()
+ {
+ unset($this->options);
+ unset($this->client);
+ unset($this->object);
+ }
+
+ /**
+ * Tests the getPageInfo method
+ */
+ public function testGetPageInfo()
+ {
+ $returnData = $this->getReturnData();
+
+ $this->client
+ ->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&prop=info&titles=Main Page&format=xml')
+ ->willReturn($returnData);
+
+ $this->assertEquals(
+ simplexml_load_string($this->sampleString),
+ $this->object->getPageInfo(array('Main Page'))
+ );
+ }
+
+ /**
+ * Tests the getPageProperties method
+ */
+ public function testGetPageProperties()
+ {
+ $returnData = $this->getReturnData();
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&prop=pageprops&titles=Main Page&format=xml')
+ ->willReturn($returnData);
+
+ $this->assertEquals(
+ simplexml_load_string($this->sampleString),
+ $this->object->getPageProperties(array('Main Page'))
+ );
+ }
+
+ /**
+ * Tests the getBackLinks method
+ */
+ public function testGetBackLinks()
+ {
+ $returnData = $this->getReturnData();
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&list=backlinks&bltitle=Joomla&format=xml')
+ ->willReturn($returnData);
+
+ $this->assertEquals(
+ simplexml_load_string($this->sampleString),
+ $this->object->getBackLinks('Joomla')
+ );
+ }
+
+ /**
+ * Tests the getIWBackLinks method
+ */
+ public function testGetIWBackLinks()
+ {
+ $returnData = $this->getReturnData();
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&list=iwbacklinks&iwbltitle=Joomla&format=xml')
+ ->willReturn($returnData);
+
+ $this->assertEquals(
+ simplexml_load_string($this->sampleString),
+ $this->object->getIWBackLinks('Joomla')
+ );
+ }
+
+ /**
+ * @return stdClass
+ */
+ private function getReturnData()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ return $returnData;
+ }
+}
diff --git a/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiSearchTest.php b/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiSearchTest.php
index 216662477aa33..9db4c9ee8bd19 100644
--- a/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiSearchTest.php
+++ b/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiSearchTest.php
@@ -1,125 +1,125 @@
-';
-
- /**
- * @var string Sample xml error message.
- * @since 12.3
- */
- protected $errorString = 'Generic Error';
-
- /**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- *
- * @access protected
- *
- * @return void
- */
- protected function setUp()
- {
- $this->options = new JRegistry;
- $this->client = $this->getMock('JMediawikiHttp', array('get', 'post', 'delete', 'patch', 'put'));
-
- $this->object = new JMediawikiSearch($this->options, $this->client);
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- *
- * @return void
- *
- * @see PHPUnit_Framework_TestCase::tearDown()
- * @since 3.6
- */
- protected function tearDown()
- {
- unset($this->options);
- unset($this->client);
- unset($this->object);
- }
-
- /**
- * Tests the search method
- *
- * @return void
- */
- public function testSearch()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&list=search&srsearch=test&format=xml')
- ->will($this->returnValue($returnData));
-
- $this->assertThat(
- $this->object->search('test'),
- $this->equalTo(simplexml_load_string($this->sampleString))
- );
- }
-
- /**
- * Tests the openSearch method
- *
- * @return void
- */
- public function testOpenSearch()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&list=search&search=test&format=xml')
- ->will($this->returnValue($returnData));
-
- $this->assertThat(
- $this->object->openSearch('test'),
- $this->equalTo(simplexml_load_string($this->sampleString))
- );
- }
-}
+';
+
+ /**
+ * @var string Sample xml error message.
+ * @since 12.3
+ */
+ protected $errorString = 'Generic Error';
+
+ /**
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test is executed.
+ *
+ * @access protected
+ *
+ * @return void
+ */
+ protected function setUp()
+ {
+ $this->options = new JRegistry;
+ $this->client = $this->getMockBuilder('JMediawikiHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+
+ $this->object = new JMediawikiSearch($this->options, $this->client);
+ }
+
+ /**
+ * Tears down the fixture, for example, closes a network connection.
+ * This method is called after a test is executed.
+ *
+ * @return void
+ *
+ * @see PHPUnit_Framework_TestCase::tearDown()
+ * @since 3.6
+ */
+ protected function tearDown()
+ {
+ unset($this->options);
+ unset($this->client);
+ unset($this->object);
+ }
+
+ /**
+ * Tests the search method
+ *
+ * @return void
+ */
+ public function testSearch()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&list=search&srsearch=test&format=xml')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->search('test'),
+ $this->equalTo(simplexml_load_string($this->sampleString))
+ );
+ }
+
+ /**
+ * Tests the openSearch method
+ *
+ * @return void
+ */
+ public function testOpenSearch()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&list=search&search=test&format=xml')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->openSearch('test'),
+ $this->equalTo(simplexml_load_string($this->sampleString))
+ );
+ }
+}
diff --git a/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiSitesTest.php b/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiSitesTest.php
index 19dd956290d88..216928f5c80bc 100644
--- a/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiSitesTest.php
+++ b/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiSitesTest.php
@@ -1,169 +1,169 @@
-';
-
- /**
- * @var string Sample xml error message.
- * @since 12.3
- */
- protected $errorString = 'Generic Error';
-
- /**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- *
- * @access protected
- *
- * @return void
- */
- protected function setUp()
- {
- $this->options = new JRegistry;
- $this->client = $this->getMock('JMediawikiHttp', array('get', 'post', 'delete', 'patch', 'put'));
-
- $this->object = new JMediawikiSites($this->options, $this->client);
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- *
- * @return void
- *
- * @see PHPUnit_Framework_TestCase::tearDown()
- * @since 3.6
- */
- protected function tearDown()
- {
- unset($this->options);
- unset($this->client);
- unset($this->object);
- }
-
- /**
- * Tests the getSiteInfo method
- *
- * @return void
- */
- public function testGetSiteInfo()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&meta=siteinfo&format=xml')
- ->will($this->returnValue($returnData));
-
- $this->assertThat(
- $this->object->getSiteInfo(),
- $this->equalTo(simplexml_load_string($this->sampleString))
- );
- }
-
- /**
- * Tests the getEvents method
- *
- * @return void
- */
- public function testGetEvents()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&list=logevents&format=xml')
- ->will($this->returnValue($returnData));
-
- $this->assertThat(
- $this->object->getEvents(),
- $this->equalTo(simplexml_load_string($this->sampleString))
- );
- }
-
- /**
- * Tests the getRecentChanges method
- *
- * @return void
- */
- public function testGetRecentChanges()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&list=recentchanges&format=xml')
- ->will($this->returnValue($returnData));
-
- $this->assertThat(
- $this->object->getRecentChanges(),
- $this->equalTo(simplexml_load_string($this->sampleString))
- );
- }
-
- /**
- * Tests the getProtectedTitles method
- *
- * @return void
- */
- public function testGetProtectedTitles()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&list=protectedtitles&format=xml')
- ->will($this->returnValue($returnData));
-
- $this->assertThat(
- $this->object->getProtectedTitles(),
- $this->equalTo(simplexml_load_string($this->sampleString))
- );
- }
-}
+';
+
+ /**
+ * @var string Sample xml error message.
+ * @since 12.3
+ */
+ protected $errorString = 'Generic Error';
+
+ /**
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test is executed.
+ *
+ * @access protected
+ *
+ * @return void
+ */
+ protected function setUp()
+ {
+ $this->options = new JRegistry;
+ $this->client = $this->getMockBuilder('JMediawikiHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+
+ $this->object = new JMediawikiSites($this->options, $this->client);
+ }
+
+ /**
+ * Tears down the fixture, for example, closes a network connection.
+ * This method is called after a test is executed.
+ *
+ * @return void
+ *
+ * @see PHPUnit_Framework_TestCase::tearDown()
+ * @since 3.6
+ */
+ protected function tearDown()
+ {
+ unset($this->options);
+ unset($this->client);
+ unset($this->object);
+ }
+
+ /**
+ * Tests the getSiteInfo method
+ *
+ * @return void
+ */
+ public function testGetSiteInfo()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&meta=siteinfo&format=xml')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->getSiteInfo(),
+ $this->equalTo(simplexml_load_string($this->sampleString))
+ );
+ }
+
+ /**
+ * Tests the getEvents method
+ *
+ * @return void
+ */
+ public function testGetEvents()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&list=logevents&format=xml')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->getEvents(),
+ $this->equalTo(simplexml_load_string($this->sampleString))
+ );
+ }
+
+ /**
+ * Tests the getRecentChanges method
+ *
+ * @return void
+ */
+ public function testGetRecentChanges()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&list=recentchanges&format=xml')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->getRecentChanges(),
+ $this->equalTo(simplexml_load_string($this->sampleString))
+ );
+ }
+
+ /**
+ * Tests the getProtectedTitles method
+ *
+ * @return void
+ */
+ public function testGetProtectedTitles()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&list=protectedtitles&format=xml')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->getProtectedTitles(),
+ $this->equalTo(simplexml_load_string($this->sampleString))
+ );
+ }
+}
diff --git a/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiTest.php b/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiTest.php
index c49e43b51a3b8..2abbb28ce40ed 100644
--- a/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiTest.php
+++ b/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiTest.php
@@ -1,189 +1,189 @@
-';
-
- /**
- * @var string Sample xml error message.
- * @since 12.3
- */
- protected $errorString = 'Generic Error';
-
- /**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- *
- * @access protected
- *
- * @return void
- */
- protected function setUp()
- {
- $this->options = new JRegistry;
- $this->client = $this->getMock('JMediawikiHttp', array('get', 'post', 'delete', 'patch', 'put'));
-
- $this->object = new JMediawiki($this->options, $this->client);
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- *
- * @return void
- *
- * @see PHPUnit_Framework_TestCase::tearDown()
- * @since 3.6
- */
- protected function tearDown()
- {
- unset($this->options);
- unset($this->client);
- unset($this->object);
- }
-
- /**
- * Tests the magic __get method - pages
- *
- * @return void
- */
- public function test__GetPages()
- {
- $this->assertThat(
- $this->object->pages,
- $this->isInstanceOf('JMediawikiPages')
- );
- }
-
- /**
- * Tests the magic __get method - users
- *
- * @return void
- */
- public function test__GetUsers()
- {
- $this->assertThat(
- $this->object->users,
- $this->isInstanceOf('JMediawikiUsers')
- );
- }
-
- /**
- * Tests the magic __get method - links
- *
- * @return void
- */
- public function test__GetLinks()
- {
- $this->assertThat(
- $this->object->links,
- $this->isInstanceOf('JMediawikiLinks')
- );
- }
-
- /**
- * Tests the magic __get method - categories
- *
- * @return void
- */
- public function test__GetCategories()
- {
- $this->assertThat(
- $this->object->categories,
- $this->isInstanceOf('JMediawikiCategories')
- );
- }
-
- /**
- * Tests the magic __get method - images
- *
- * @return void
- */
- public function test__GetImages()
- {
- $this->assertThat(
- $this->object->images,
- $this->isInstanceOf('JMediawikiImages')
- );
- }
-
- /**
- * Tests the magic __get method - search
- *
- * @return void
- */
- public function test__GetSearch()
- {
- $this->assertThat(
- $this->object->search,
- $this->isInstanceOf('JMediawikiSearch')
- );
- }
-
- /**
- * Tests the setOption method
- *
- * @return void
- */
- public function testSetOption()
- {
- $this->object->setOption('api.url', 'https://example.com/settest');
-
- $this->assertThat(
- $this->options->get('api.url'),
- $this->equalTo('https://example.com/settest')
- );
- }
-
- /**
- * Tests the getOption method
- *
- * @return void
- */
- public function testGetOption()
- {
- $this->options->set('api.url', 'https://example.com/gettest');
-
- $this->assertThat(
- $this->object->getOption('api.url', 'https://example.com/gettest'),
- $this->equalTo('https://example.com/gettest')
- );
- }
-}
+';
+
+ /**
+ * @var string Sample xml error message.
+ * @since 12.3
+ */
+ protected $errorString = 'Generic Error';
+
+ /**
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test is executed.
+ *
+ * @access protected
+ *
+ * @return void
+ */
+ protected function setUp()
+ {
+ $this->options = new JRegistry;
+ $this->client = $this->getMockBuilder('JMediawikiHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+
+ $this->object = new JMediawiki($this->options, $this->client);
+ }
+
+ /**
+ * Tears down the fixture, for example, closes a network connection.
+ * This method is called after a test is executed.
+ *
+ * @return void
+ *
+ * @see PHPUnit_Framework_TestCase::tearDown()
+ * @since 3.6
+ */
+ protected function tearDown()
+ {
+ unset($this->options);
+ unset($this->client);
+ unset($this->object);
+ }
+
+ /**
+ * Tests the magic __get method - pages
+ *
+ * @return void
+ */
+ public function test__GetPages()
+ {
+ $this->assertThat(
+ $this->object->pages,
+ $this->isInstanceOf('JMediawikiPages')
+ );
+ }
+
+ /**
+ * Tests the magic __get method - users
+ *
+ * @return void
+ */
+ public function test__GetUsers()
+ {
+ $this->assertThat(
+ $this->object->users,
+ $this->isInstanceOf('JMediawikiUsers')
+ );
+ }
+
+ /**
+ * Tests the magic __get method - links
+ *
+ * @return void
+ */
+ public function test__GetLinks()
+ {
+ $this->assertThat(
+ $this->object->links,
+ $this->isInstanceOf('JMediawikiLinks')
+ );
+ }
+
+ /**
+ * Tests the magic __get method - categories
+ *
+ * @return void
+ */
+ public function test__GetCategories()
+ {
+ $this->assertThat(
+ $this->object->categories,
+ $this->isInstanceOf('JMediawikiCategories')
+ );
+ }
+
+ /**
+ * Tests the magic __get method - images
+ *
+ * @return void
+ */
+ public function test__GetImages()
+ {
+ $this->assertThat(
+ $this->object->images,
+ $this->isInstanceOf('JMediawikiImages')
+ );
+ }
+
+ /**
+ * Tests the magic __get method - search
+ *
+ * @return void
+ */
+ public function test__GetSearch()
+ {
+ $this->assertThat(
+ $this->object->search,
+ $this->isInstanceOf('JMediawikiSearch')
+ );
+ }
+
+ /**
+ * Tests the setOption method
+ *
+ * @return void
+ */
+ public function testSetOption()
+ {
+ $this->object->setOption('api.url', 'https://example.com/settest');
+
+ $this->assertThat(
+ $this->options->get('api.url'),
+ $this->equalTo('https://example.com/settest')
+ );
+ }
+
+ /**
+ * Tests the getOption method
+ *
+ * @return void
+ */
+ public function testGetOption()
+ {
+ $this->options->set('api.url', 'https://example.com/gettest');
+
+ $this->assertThat(
+ $this->object->getOption('api.url', 'https://example.com/gettest'),
+ $this->equalTo('https://example.com/gettest')
+ );
+ }
+}
diff --git a/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiUsersTest.php b/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiUsersTest.php
index 499be6091e846..b573a8eae0fc3 100644
--- a/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiUsersTest.php
+++ b/tests/unit/suites/libraries/joomla/mediawiki/JMediawikiUsersTest.php
@@ -1,139 +1,139 @@
-';
-
- /**
- * @var string Sample xml error message.
- */
- protected $errorString = 'Generic Error';
-
- /**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- *
- * @return void
- */
- protected function setUp()
- {
- $this->options = new JRegistry;
- $this->client = $this->getMock('JMediawikiHttp', array('get', 'post', 'delete', 'patch', 'put'));
-
- $this->object = new JMediawikiUsers($this->options, $this->client);
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- *
- * @return void
- *
- * @see PHPUnit_Framework_TestCase::tearDown()
- * @since 3.6
- */
- protected function tearDown()
- {
- unset($this->options);
- unset($this->client);
- unset($this->object);
- }
-
- /**
- * Tests the getUserInfo method
- */
- public function testGetUserInfo()
- {
- $returnData = $this->getReturnData();
-
- $this->client
- ->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&list=users&ususers=Joomla&format=xml')
- ->willReturn($returnData);
-
- $this->assertEquals(
- simplexml_load_string($this->sampleString),
- $this->object->getUserInfo(array('Joomla'))
- );
- }
-
- /**
- * Tests the getCurrentUserInfo method
- */
- public function testGetCurrentUserInfo()
- {
- $returnData = $this->getReturnData();
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&meta=userinfo&format=xml')
- ->willReturn($returnData);
-
- $this->assertEquals(
- simplexml_load_string($this->sampleString),
- $this->object->getCurrentUserInfo()
- );
- }
-
- /**
- * Tests the getUserContribs method
- */
- public function testGetUserContribs()
- {
- $returnData = $this->getReturnData();
-
- $this->client->expects($this->once())
- ->method('get')
- ->with('/api.php?action=query&list=usercontribs&ucuser=Joomla&format=xml')
- ->willReturn($returnData);
-
- $this->assertEquals(
- simplexml_load_string($this->sampleString),
- $this->object->getUserContribs('Joomla')
- );
- }
-
- /**
- * @return stdClass
- */
- private function getReturnData()
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
-
- return $returnData;
- }
-}
+';
+
+ /**
+ * @var string Sample xml error message.
+ */
+ protected $errorString = 'Generic Error';
+
+ /**
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test is executed.
+ *
+ * @return void
+ */
+ protected function setUp()
+ {
+ $this->options = new JRegistry;
+ $this->client = $this->getMockBuilder('JMediawikiHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
+
+ $this->object = new JMediawikiUsers($this->options, $this->client);
+ }
+
+ /**
+ * Tears down the fixture, for example, closes a network connection.
+ * This method is called after a test is executed.
+ *
+ * @return void
+ *
+ * @see PHPUnit_Framework_TestCase::tearDown()
+ * @since 3.6
+ */
+ protected function tearDown()
+ {
+ unset($this->options);
+ unset($this->client);
+ unset($this->object);
+ }
+
+ /**
+ * Tests the getUserInfo method
+ */
+ public function testGetUserInfo()
+ {
+ $returnData = $this->getReturnData();
+
+ $this->client
+ ->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&list=users&ususers=Joomla&format=xml')
+ ->willReturn($returnData);
+
+ $this->assertEquals(
+ simplexml_load_string($this->sampleString),
+ $this->object->getUserInfo(array('Joomla'))
+ );
+ }
+
+ /**
+ * Tests the getCurrentUserInfo method
+ */
+ public function testGetCurrentUserInfo()
+ {
+ $returnData = $this->getReturnData();
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&meta=userinfo&format=xml')
+ ->willReturn($returnData);
+
+ $this->assertEquals(
+ simplexml_load_string($this->sampleString),
+ $this->object->getCurrentUserInfo()
+ );
+ }
+
+ /**
+ * Tests the getUserContribs method
+ */
+ public function testGetUserContribs()
+ {
+ $returnData = $this->getReturnData();
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/api.php?action=query&list=usercontribs&ucuser=Joomla&format=xml')
+ ->willReturn($returnData);
+
+ $this->assertEquals(
+ simplexml_load_string($this->sampleString),
+ $this->object->getUserContribs('Joomla')
+ );
+ }
+
+ /**
+ * @return stdClass
+ */
+ private function getReturnData()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ return $returnData;
+ }
+}
diff --git a/tests/unit/suites/libraries/joomla/oauth1/JOAuth1ClientTest.php b/tests/unit/suites/libraries/joomla/oauth1/JOAuth1ClientTest.php
index 8770b788def0c..f96c238cbddae 100644
--- a/tests/unit/suites/libraries/joomla/oauth1/JOAuth1ClientTest.php
+++ b/tests/unit/suites/libraries/joomla/oauth1/JOAuth1ClientTest.php
@@ -94,7 +94,7 @@ protected function setUp()
$my_url = "TEST_URL";
$this->options = new Registry;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->input = new JInput(array());
$this->application = $this->getMockWeb();
@@ -205,7 +205,7 @@ public function testAuthenticate($token, $fail, $version)
TestReflection::setValue($input, 'data', $data);
// Get mock session
- $mockSession = $this->getMock('JSession', array( '_start', 'get'));
+ $mockSession = $this->getMockBuilder('JSession')->setMethods(array( '_start', 'get'))->getMock();
if ($fail)
{
diff --git a/tests/unit/suites/libraries/joomla/oauth2/JOauth2ClientTest.php b/tests/unit/suites/libraries/joomla/oauth2/JOauth2ClientTest.php
index e1b842e4c72ea..ba74cd87f8975 100644
--- a/tests/unit/suites/libraries/joomla/oauth2/JOauth2ClientTest.php
+++ b/tests/unit/suites/libraries/joomla/oauth2/JOauth2ClientTest.php
@@ -74,7 +74,10 @@ protected function setUp()
$_SERVER['SCRIPT_NAME'] = '/index.php';
$this->options = new Registry;
- $this->http = $this->getMock('JHttp', array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'), array($this->options));
+ $this->http = $this->getMockBuilder('JHttp')
+ ->setMethods(array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'))
+ ->setConstructorArgs(array($this->options))
+ ->getMock();
$array = array();
$this->input = new JInput($array);
$this->application = $this->getMockWeb();
diff --git a/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapChangesetsTest.php b/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapChangesetsTest.php
index 8ba00ace91f7d..0e9f9af0af84e 100644
--- a/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapChangesetsTest.php
+++ b/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapChangesetsTest.php
@@ -96,7 +96,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JOpenstreetmapOauth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapElementsTest.php b/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapElementsTest.php
index f939c0278ea96..a1cb4efe4f384 100644
--- a/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapElementsTest.php
+++ b/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapElementsTest.php
@@ -96,7 +96,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JOpenstreetmapOauth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapGpsTest.php b/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapGpsTest.php
index fe9e42720594f..79d12d37505e8 100644
--- a/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapGpsTest.php
+++ b/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapGpsTest.php
@@ -96,7 +96,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JOpenstreetmapOauth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapInfoTest.php b/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapInfoTest.php
index a7bff38ba1fb1..a7de96f2cdc65 100644
--- a/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapInfoTest.php
+++ b/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapInfoTest.php
@@ -96,7 +96,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JOpenstreetmapOauth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapOauthTest.php b/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapOauthTest.php
index 8fa575919a3ee..4a2a3383189d0 100644
--- a/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapOauthTest.php
+++ b/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapOauthTest.php
@@ -74,7 +74,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->options->set('consumer_key', $key);
$this->options->set('consumer_secret', $secret);
diff --git a/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapObjectTest.php b/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapObjectTest.php
index bec5287851ca7..a465fabd5d018 100644
--- a/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapObjectTest.php
+++ b/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapObjectTest.php
@@ -48,7 +48,7 @@ class JOpenstreetmapObjectTest extends TestCase
protected function setUp()
{
$this->options = new JRegistry;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->object = new JOpenstreetmapObjectMock($this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapTest.php b/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapTest.php
index e97de85b6aad2..c4408c25cdc1f 100644
--- a/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapTest.php
+++ b/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapTest.php
@@ -63,7 +63,7 @@ protected function setUp()
$_SERVER['SCRIPT_NAME'] = '/index.php';
$this->options = new JRegistry;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->object = new JOpenstreetmap($this->oauth, $this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapUserTest.php b/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapUserTest.php
index 00828999f88b5..fd41ce7c4e8d3 100644
--- a/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapUserTest.php
+++ b/tests/unit/suites/libraries/joomla/openstreetmap/JOpenstreetmapUserTest.php
@@ -96,7 +96,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JOpenstreetmapOauth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/session/JSessionTest.php b/tests/unit/suites/libraries/joomla/session/JSessionTest.php
index 5bf2abfb54dd3..f4e6cb5783d82 100644
--- a/tests/unit/suites/libraries/joomla/session/JSessionTest.php
+++ b/tests/unit/suites/libraries/joomla/session/JSessionTest.php
@@ -47,7 +47,7 @@ protected function setUp()
$this->object = JSession::getInstance('none', $config, $handler);
$this->input = new JInput;
- $this->input->cookie = $this->getMock('JInputCookie', array('set', 'get'));
+ $this->input->cookie = $this->getMockBuilder('JInputCookie')->setMethods(array('set', 'get'))->getMock();
$this->object->initialise($this->input);
$this->input->cookie->expects($this->any())
diff --git a/tests/unit/suites/libraries/joomla/table/JTableNestedTest.php b/tests/unit/suites/libraries/joomla/table/JTableNestedTest.php
index c67b366f8eb5f..f37bd3e94e6e9 100644
--- a/tests/unit/suites/libraries/joomla/table/JTableNestedTest.php
+++ b/tests/unit/suites/libraries/joomla/table/JTableNestedTest.php
@@ -88,11 +88,10 @@ public function testDelete()
$this->assertArrayNotHasKey(204, $ids, 'Checks node 204 was deleted.');
// We need to confirm the locking is called, so we create a mock.
- $class = $this->getMock(
- 'NestedTable',
- array('_lock'),
- array(self::$driver)
- );
+ $class = $this->getMockBuilder('NestedTable')
+ ->setMethods(array('_lock'))
+ ->setConstructorArgs(array(self::$driver))
+ ->getMock();
$class->expects($this->any())->method('_lock')->will($this->returnValue(false));
$this->assertFalse($class->delete(1), 'Checks a locked table returns false.');
@@ -349,11 +348,10 @@ public function testMoveByReference_failures()
$this->assertFalse($this->class->moveByReference(202, 'after'), 'Checks moving to a child.');
// We need to confirm the locking is called, so we create a mock.
- $class = $this->getMock(
- 'NestedTable',
- array('_lock'),
- array(self::$driver)
- );
+ $class = $this->getMockBuilder('NestedTable')
+ ->setMethods(array('_lock'))
+ ->setConstructorArgs(array(self::$driver))
+ ->getMock();
$class->expects($this->any())->method('_lock')->will($this->returnValue(false));
$this->assertFalse($class->moveByReference(103, 'after', 102), 'Checks a locked table returns false.');
@@ -601,11 +599,10 @@ public function testStore()
$this->assertEquals(9, $this->class->rgt, 'Check new rgt.');
// We need to confirm the locking is called, so we create a mock.
- $class = $this->getMock(
- 'NestedTable',
- array('_lock'),
- array(self::$driver)
- );
+ $class = $this->getMockBuilder('NestedTable')
+ ->setMethods(array('_lock'))
+ ->setConstructorArgs(array(self::$driver))
+ ->getMock();
$class->expects($this->any())->method('_lock')->will($this->returnValue(false));
$this->assertFalse($class->store(), 'Checks a locked table returns false.');
@@ -725,11 +722,10 @@ public function test_runQuery()
try
{
// We need to confirm the locking is called, so we create a mock.
- $class = $this->getMock(
- 'NestedTable',
- array('_unlock'),
- array(self::$driver)
- );
+ $class = $this->getMockBuilder('NestedTable')
+ ->setMethods(array('_unlock'))
+ ->setConstructorArgs(array(self::$driver))
+ ->getMock();
// Then override the _unlock method so we can test that it was called.
$this->assignMockCallbacks(
diff --git a/tests/unit/suites/libraries/joomla/twitter/JTwitterBlockTest.php b/tests/unit/suites/libraries/joomla/twitter/JTwitterBlockTest.php
index fe8e22cba47e1..906566b005a45 100644
--- a/tests/unit/suites/libraries/joomla/twitter/JTwitterBlockTest.php
+++ b/tests/unit/suites/libraries/joomla/twitter/JTwitterBlockTest.php
@@ -101,7 +101,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JTwitterOAuth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/twitter/JTwitterDirectmessagesTest.php b/tests/unit/suites/libraries/joomla/twitter/JTwitterDirectmessagesTest.php
index fa5781bacb0a0..742cf03554bab 100644
--- a/tests/unit/suites/libraries/joomla/twitter/JTwitterDirectmessagesTest.php
+++ b/tests/unit/suites/libraries/joomla/twitter/JTwitterDirectmessagesTest.php
@@ -107,7 +107,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JTwitterOAuth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/twitter/JTwitterFavoritesTest.php b/tests/unit/suites/libraries/joomla/twitter/JTwitterFavoritesTest.php
index 746835bbbb3d0..3b11c3b1e2ae1 100644
--- a/tests/unit/suites/libraries/joomla/twitter/JTwitterFavoritesTest.php
+++ b/tests/unit/suites/libraries/joomla/twitter/JTwitterFavoritesTest.php
@@ -99,7 +99,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JTwitterOAuth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/twitter/JTwitterFriendsTest.php b/tests/unit/suites/libraries/joomla/twitter/JTwitterFriendsTest.php
index 1c4bbece542e0..e2573d02c5387 100644
--- a/tests/unit/suites/libraries/joomla/twitter/JTwitterFriendsTest.php
+++ b/tests/unit/suites/libraries/joomla/twitter/JTwitterFriendsTest.php
@@ -120,7 +120,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JTwitterOAuth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/twitter/JTwitterHelpTest.php b/tests/unit/suites/libraries/joomla/twitter/JTwitterHelpTest.php
index 1e23c78b209a3..9da57fe063044 100644
--- a/tests/unit/suites/libraries/joomla/twitter/JTwitterHelpTest.php
+++ b/tests/unit/suites/libraries/joomla/twitter/JTwitterHelpTest.php
@@ -94,7 +94,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JTwitterOAuth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/twitter/JTwitterListsTest.php b/tests/unit/suites/libraries/joomla/twitter/JTwitterListsTest.php
index c69f58aa044eb..4e866a1e737a1 100644
--- a/tests/unit/suites/libraries/joomla/twitter/JTwitterListsTest.php
+++ b/tests/unit/suites/libraries/joomla/twitter/JTwitterListsTest.php
@@ -112,7 +112,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JTwitterOAuth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/twitter/JTwitterOauthTest.php b/tests/unit/suites/libraries/joomla/twitter/JTwitterOauthTest.php
index 80befb2fdc953..e976142145715 100644
--- a/tests/unit/suites/libraries/joomla/twitter/JTwitterOauthTest.php
+++ b/tests/unit/suites/libraries/joomla/twitter/JTwitterOauthTest.php
@@ -87,7 +87,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = $this->getMockInput();
$this->application = $this->getMockWeb();
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->options->set('consumer_key', $key);
$this->options->set('consumer_secret', $secret);
diff --git a/tests/unit/suites/libraries/joomla/twitter/JTwitterObjectTest.php b/tests/unit/suites/libraries/joomla/twitter/JTwitterObjectTest.php
index 0ba1b4466127f..ad946cf0abd72 100644
--- a/tests/unit/suites/libraries/joomla/twitter/JTwitterObjectTest.php
+++ b/tests/unit/suites/libraries/joomla/twitter/JTwitterObjectTest.php
@@ -93,7 +93,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JTwitterOAuth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/twitter/JTwitterPlacesTest.php b/tests/unit/suites/libraries/joomla/twitter/JTwitterPlacesTest.php
index 6306c3fa33eb2..83eb4f6be679a 100644
--- a/tests/unit/suites/libraries/joomla/twitter/JTwitterPlacesTest.php
+++ b/tests/unit/suites/libraries/joomla/twitter/JTwitterPlacesTest.php
@@ -103,7 +103,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JTwitterOAuth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/twitter/JTwitterProfileTest.php b/tests/unit/suites/libraries/joomla/twitter/JTwitterProfileTest.php
index 3213c5b95f930..c8fb629d6dda7 100644
--- a/tests/unit/suites/libraries/joomla/twitter/JTwitterProfileTest.php
+++ b/tests/unit/suites/libraries/joomla/twitter/JTwitterProfileTest.php
@@ -103,7 +103,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JTwitterOAuth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/twitter/JTwitterSearchTest.php b/tests/unit/suites/libraries/joomla/twitter/JTwitterSearchTest.php
index 637a94afd0b0c..5b8c0c003929a 100644
--- a/tests/unit/suites/libraries/joomla/twitter/JTwitterSearchTest.php
+++ b/tests/unit/suites/libraries/joomla/twitter/JTwitterSearchTest.php
@@ -109,7 +109,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JTwitterOAuth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/twitter/JTwitterStatusesTest.php b/tests/unit/suites/libraries/joomla/twitter/JTwitterStatusesTest.php
index 8af61663b7942..aceb3d257c4f0 100644
--- a/tests/unit/suites/libraries/joomla/twitter/JTwitterStatusesTest.php
+++ b/tests/unit/suites/libraries/joomla/twitter/JTwitterStatusesTest.php
@@ -105,7 +105,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JTwitterOAuth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/twitter/JTwitterTest.php b/tests/unit/suites/libraries/joomla/twitter/JTwitterTest.php
index 05455c3b68084..450aa98048676 100644
--- a/tests/unit/suites/libraries/joomla/twitter/JTwitterTest.php
+++ b/tests/unit/suites/libraries/joomla/twitter/JTwitterTest.php
@@ -63,7 +63,7 @@ protected function setUp()
$_SERVER['SCRIPT_NAME'] = '/index.php';
$this->options = new JRegistry;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->object = new JTwitter($this->oauth, $this->options, $this->client);
}
diff --git a/tests/unit/suites/libraries/joomla/twitter/JTwitterTrendsTest.php b/tests/unit/suites/libraries/joomla/twitter/JTwitterTrendsTest.php
index 03211fae02b6e..7cc26cd8e5526 100644
--- a/tests/unit/suites/libraries/joomla/twitter/JTwitterTrendsTest.php
+++ b/tests/unit/suites/libraries/joomla/twitter/JTwitterTrendsTest.php
@@ -101,7 +101,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JTwitterOAuth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/twitter/JTwitterUsersTest.php b/tests/unit/suites/libraries/joomla/twitter/JTwitterUsersTest.php
index 8319f3f2b387d..498132ccc6083 100644
--- a/tests/unit/suites/libraries/joomla/twitter/JTwitterUsersTest.php
+++ b/tests/unit/suites/libraries/joomla/twitter/JTwitterUsersTest.php
@@ -107,7 +107,7 @@ protected function setUp()
$this->options = new JRegistry;
$this->input = new JInput;
- $this->client = $this->getMock('JHttp', array('get', 'post', 'delete', 'put'));
+ $this->client = $this->getMockBuilder('JHttp')->setMethods(array('get', 'post', 'delete', 'put'))->getMock();
$this->oauth = new JTwitterOAuth($this->options, $this->client, $this->input);
$this->oauth->setToken($access_token);
diff --git a/tests/unit/suites/libraries/joomla/user/JUserTest.php b/tests/unit/suites/libraries/joomla/user/JUserTest.php
index eb75da18e271a..758a1143b0ade 100644
--- a/tests/unit/suites/libraries/joomla/user/JUserTest.php
+++ b/tests/unit/suites/libraries/joomla/user/JUserTest.php
@@ -243,7 +243,7 @@ public function casesAuthorise()
public function testAuthorise($userId, $action, $asset, $expected)
{
// Set up user 99 to be root_user from configuration
- $testConfig = $this->getMock('JConfig', array('get'));
+ $testConfig = $this->getMockBuilder('JConfig')->setMethods(array('get'))->getMock();
$testConfig->expects(
$this->any()
)
diff --git a/tests/unit/suites/libraries/joomla/view/mocks/JModelMock.php b/tests/unit/suites/libraries/joomla/view/mocks/JModelMock.php
index 561d955abdd14..dbb560aca3f77 100644
--- a/tests/unit/suites/libraries/joomla/view/mocks/JModelMock.php
+++ b/tests/unit/suites/libraries/joomla/view/mocks/JModelMock.php
@@ -31,17 +31,13 @@ public static function create($test)
'setState',
);
- // Create the mock.
- $mockObject = $test->getMock(
- 'JModel',
- $methods,
- // Constructor arguments.
- array(),
- // Mock class name.
- '',
- // Call original constructor.
- false
- );
+ // Build the mock object.
+ $mockObject = $test->getMockBuilder('JModel')
+ ->setMethods($methods)
+ ->setConstructorArgs(array())
+ ->setMockClassName('')
+ ->disableOriginalConstructor()
+ ->getMock();
return $mockObject;
}
diff --git a/tests/unit/suites/libraries/legacy/model/JModelLegacyTest.php b/tests/unit/suites/libraries/legacy/model/JModelLegacyTest.php
index 16a554a2b2c41..ad7469190db51 100644
--- a/tests/unit/suites/libraries/legacy/model/JModelLegacyTest.php
+++ b/tests/unit/suites/libraries/legacy/model/JModelLegacyTest.php
@@ -620,7 +620,7 @@ public function testGetListCountPassesQueryObjectToDatabase()
$method = new ReflectionMethod('TestModelLead', '_getListCount');
$method->setAccessible(true);
- $queryMock = $this->getMock('JDatabaseQuery', array('select', 'clear'));
+ $queryMock = $this->getMockBuilder('JDatabaseQuery')->setMethods(array('select', 'clear'))->getMock();
$queryMock->method('clear')->will($this->returnSelf());
TestReflection::setValue($queryMock, 'type', 'select');