From 4f99ff5266e95b32236ce12189b25671d77e6947 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 08:43:43 -0700 Subject: [PATCH 01/88] Use getMockBuilder rather than getMock directly Avoid situations that would cause `PHP Fatal error: Call to protected method PHPUnit_Framework_TestCase::getMock()` on newer versions of phpunit --- tests/unit/core/mock/document.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) 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( From c4ca3b928a4c395d8bd031ce4d83630be3c78664 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 08:47:52 -0700 Subject: [PATCH 02/88] Use getMockBuilder rather than getMock directly --- tests/unit/core/mock/language.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) 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( From 9771819a93f17e1a5997d9e9067d2fba9c3a76e8 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 08:51:20 -0700 Subject: [PATCH 03/88] Use getMockBuilder rather than getMock directly --- tests/unit/core/mock/application.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) 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()) From e6262cd229bae1cd1df4c2f1d760dba7ae4d7a5c Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 08:52:39 -0700 Subject: [PATCH 04/88] Use getMockBuilder rather than getMock directly --- tests/unit/core/mock/cache.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) 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, From a3bb8def9dd822b10f85a337be3cda9adb2fa09c Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 08:54:40 -0700 Subject: [PATCH 05/88] Use getMockBuilder rather than getMock directly --- tests/unit/core/mock/config.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) 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; } From 56df791c76e21157ec945ba7e5652f39d9b026fd Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 08:56:21 -0700 Subject: [PATCH 06/88] Use getMockBuilder rather than getMock directly --- tests/unit/core/mock/controller.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) 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); From e149f28f6594316365711d55def97950759b7e04 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 08:57:26 -0700 Subject: [PATCH 07/88] Use getMockBuilder rather than getMock directly --- tests/unit/core/mock/dispatcher.php | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) 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( From fd692ca95f4c764af51a86e1ca8f8fe916f17b96 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 09:00:16 -0700 Subject: [PATCH 08/88] Use getMockBuilder rather than getMock directly --- tests/unit/core/mock/input.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) 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, From db25133fce38ed710a8a9f257cb5aabcfc0c292d Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 09:01:14 -0700 Subject: [PATCH 09/88] Use getMockBuilder rather than getMock directly --- tests/unit/core/mock/menu.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) 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(); From cd90aeedc16b14f3b1c25dfee32c684cbbcd160b Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 09:02:49 -0700 Subject: [PATCH 10/88] Use getMockBuilder rather than getMock directly --- tests/unit/core/mock/rules.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) 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, From 7e6c2cdeff764e6b21f197fa0e26bf19efede348 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 09:04:47 -0700 Subject: [PATCH 11/88] Use getMockBuilder rather than getMock directly --- tests/unit/core/mock/session.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) 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( From 3e0fd3c43350d3beee6a8e6e94fa0123f9b0e7bf Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 09:06:20 -0700 Subject: [PATCH 12/88] Use getMockBuilder rather than getMock directly --- tests/unit/core/mock/database/driver.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) 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( From e3fee855bea1f8d21f5bcf23785d2d85ed3afed6 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 09:09:52 -0700 Subject: [PATCH 13/88] Use getMockBuilder rather than getMock directly --- tests/unit/core/mock/application/base.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) 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); From 44b5de8e93ae4d092a93c1ce8bb67896d4ca209a Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 09:11:34 -0700 Subject: [PATCH 14/88] Use getMockBuilder rather than getMock directly --- tests/unit/core/mock/application/cli.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) 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); From 733bd857305a53d542eefac2ee44c4b4e3c76c46 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 09:14:30 -0700 Subject: [PATCH 15/88] Use getMockBuilder rather than getMock directly --- tests/unit/core/mock/application/cms.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/tests/unit/core/mock/application/cms.php b/tests/unit/core/mock/application/cms.php index 33b6e9096e5b3..14a43577b6b3b 100644 --- a/tests/unit/core/mock/application/cms.php +++ b/tests/unit/core/mock/application/cms.php @@ -88,17 +88,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); From adaa7f3a929a48dabb7449143bb0e2a3fe74d960 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 09:18:51 -0700 Subject: [PATCH 16/88] Use getMockBuilder rather than getMock directly --- tests/unit/core/mock/application/web.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) 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); From 4612c4aac9c6cf9cbfa35f2462ac49db263ab88b Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 10:33:34 -0700 Subject: [PATCH 17/88] Use getMockBuilder rather than getMock directly --- .../libraries/joomla/view/mocks/JModelMock.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) 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; } From 5c658b363864e49c21c9c5c171ae7721ecd7c01d Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 10:53:05 -0700 Subject: [PATCH 18/88] Use getMockBuilder rather than getMock directly --- .../libraries/cms/application/JApplicationCmsTest.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/unit/suites/libraries/cms/application/JApplicationCmsTest.php b/tests/unit/suites/libraries/cms/application/JApplicationCmsTest.php index 53fe522b096c8..d83c04507f20c 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 = $test->getMockBuilder('JApplicationWebClient') + ->setMethods(array('test')) + ->setConstructorArgs(array()) + ->setMockClassName('') + ->disableOriginalConstructor() + ->getMock(); $inspector = new JApplicationCmsInspector($mockInput, $config, $mockClient); From 5e3c91136e20d6ed07268e096ec1d4739df2aa71 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 10:59:16 -0700 Subject: [PATCH 19/88] Use getMockBuilder rather than getMock directly --- .../unit/suites/libraries/cms/html/JHtmlTest.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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')); From 6e6dfd6c8a4ff2484f11d0b23deb9243bb4474d1 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 11:00:33 -0700 Subject: [PATCH 20/88] Use the correct $this object --- .../suites/libraries/cms/application/JApplicationCmsTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/suites/libraries/cms/application/JApplicationCmsTest.php b/tests/unit/suites/libraries/cms/application/JApplicationCmsTest.php index d83c04507f20c..b3785cffe6ce3 100644 --- a/tests/unit/suites/libraries/cms/application/JApplicationCmsTest.php +++ b/tests/unit/suites/libraries/cms/application/JApplicationCmsTest.php @@ -189,7 +189,7 @@ public function test__constructDependancyInjection() $config->set('session', false); // Build the mock object. - $mockClient = $test->getMockBuilder('JApplicationWebClient') + $mockClient = $this->getMockBuilder('JApplicationWebClient') ->setMethods(array('test')) ->setConstructorArgs(array()) ->setMockClassName('') From 15fe448319cc540f860e3f45bf3e208f125279c0 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 15:41:21 -0700 Subject: [PATCH 21/88] Use getMockBuilder rather than getMock directly --- .../cms/installer/JInstallerAdapterTest.php | 187 +++++++++++++----- 1 file changed, 135 insertions(+), 52 deletions(-) diff --git a/tests/unit/suites/libraries/cms/installer/JInstallerAdapterTest.php b/tests/unit/suites/libraries/cms/installer/JInstallerAdapterTest.php index bdc048e96627a..6393be9515196 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,7 +87,7 @@ 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)); @@ -132,7 +132,7 @@ 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)); @@ -175,7 +175,7 @@ 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)); @@ -205,7 +205,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 +264,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 +307,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 +342,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 +371,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 +416,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 +445,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 +508,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 +566,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 +583,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 +603,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 +626,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 +645,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 +679,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 +701,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 +722,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 +740,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 +786,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 +806,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 +840,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 +884,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 +919,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 +968,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 +1003,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 +1046,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 +1080,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 +1147,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 +1210,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 +1275,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 +1305,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 +1327,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 +1352,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 +1373,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 +1395,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 +1421,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 +1468,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 +1514,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 +1548,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 +1596,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 +1626,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 +1658,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 +1690,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') From 1c0d909b06acd360482e864d041a0d296da7a7ce Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 15:44:56 -0700 Subject: [PATCH 22/88] Use getMockBuilder rather than getMock directly --- tests/unit/suites/libraries/cms/installer/JInstallerTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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') From a1182eb502c6541985f00d11623e50cb898d8695 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 17:28:17 -0700 Subject: [PATCH 23/88] Set up a more mock JTableExtension with getMockBuilder --- .../cms/installer/JInstallerAdapterTest.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/unit/suites/libraries/cms/installer/JInstallerAdapterTest.php b/tests/unit/suites/libraries/cms/installer/JInstallerAdapterTest.php index 6393be9515196..210b005bc3bd6 100644 --- a/tests/unit/suites/libraries/cms/installer/JInstallerAdapterTest.php +++ b/tests/unit/suites/libraries/cms/installer/JInstallerAdapterTest.php @@ -92,7 +92,10 @@ public function testCheckExistingExtensionForExistingExtension() $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'; @@ -137,7 +140,10 @@ public function testCheckExistingExtensionForExtensionThatDoesNotExist() $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'; @@ -180,7 +186,10 @@ public function testCheckExistingExtensionReturnsErrorWhenTableGivesException() $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'; From 510509833671d8c30fb2ea9978abb572dc83f095 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 17:31:48 -0700 Subject: [PATCH 24/88] Use getMockBuilder rather than getMock directly --- .../suites/libraries/cms/language/JLanguageMultilangTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit/suites/libraries/cms/language/JLanguageMultilangTest.php b/tests/unit/suites/libraries/cms/language/JLanguageMultilangTest.php index bf7a21713720d..38b349f381320 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 = $test->getMockBuilder('JApplicationAdministrator')->getMock(); $mockApplication->expects($this->any()) ->method('isSite') ->willReturn(false); From 93b40e47eefaa0dbeb62e82d617a9a098596f069 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 17:38:13 -0700 Subject: [PATCH 25/88] Use the correct $this object --- .../suites/libraries/cms/language/JLanguageMultilangTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/suites/libraries/cms/language/JLanguageMultilangTest.php b/tests/unit/suites/libraries/cms/language/JLanguageMultilangTest.php index 38b349f381320..715463e0a383d 100644 --- a/tests/unit/suites/libraries/cms/language/JLanguageMultilangTest.php +++ b/tests/unit/suites/libraries/cms/language/JLanguageMultilangTest.php @@ -142,7 +142,7 @@ public function testIsEnabledWithSiteApp() public function testIsEnabledWithAdminApp() { // Build the mock object. - $mockApplication = $test->getMockBuilder('JApplicationAdministrator')->getMock(); + $mockApplication = $this->getMockBuilder('JApplicationAdministrator')->getMock(); $mockApplication->expects($this->any()) ->method('isSite') ->willReturn(false); From 9149b6bcd6c26ee885857f69d392dc1b2b33e3b2 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 17:42:35 -0700 Subject: [PATCH 26/88] Use getMockBuilder rather than getMock directly --- tests/unit/suites/libraries/cms/router/JRouterTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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)); } From b855cf47e4a8b1348181ee9f0ca5d8e19ab10de3 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 19:57:43 -0700 Subject: [PATCH 27/88] Use getMockBuilder rather than getMock directly --- .../application/JApplicationBaseTest.php | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) 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); From a427b408ca9f0aede74d67cdccd854944cbb62f9 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 20:16:49 -0700 Subject: [PATCH 28/88] Use getMockBuilder rather than getMock directly --- .../application/JApplicationCliTest.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/unit/suites/libraries/joomla/application/JApplicationCliTest.php b/tests/unit/suites/libraries/joomla/application/JApplicationCliTest.php index 5b50ef523ca9a..548449fb667ad 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') @@ -109,6 +120,10 @@ public function test__constructDependancyInjection() ->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.'); From 5f51380813fcbd131f698e0ce1d608547d95bce1 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 20:24:53 -0700 Subject: [PATCH 29/88] remove the method after replacing --- .../suites/libraries/joomla/application/JApplicationCliTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/unit/suites/libraries/joomla/application/JApplicationCliTest.php b/tests/unit/suites/libraries/joomla/application/JApplicationCliTest.php index 548449fb667ad..dab66e0f63c2d 100644 --- a/tests/unit/suites/libraries/joomla/application/JApplicationCliTest.php +++ b/tests/unit/suites/libraries/joomla/application/JApplicationCliTest.php @@ -119,7 +119,6 @@ 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)) From b5d6a6db170edb5227e58682ee24be15024e7d91 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 20:41:19 -0700 Subject: [PATCH 30/88] Use getMockBuilder rather than getMock directly --- .../application/JApplicationWebTest.php | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/unit/suites/libraries/joomla/application/JApplicationWebTest.php b/tests/unit/suites/libraries/joomla/application/JApplicationWebTest.php index 9cb2e929bdb2a..cffc912f5f349 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'); From 02e9a6930906235ff39073ca0f5d3abca1a3aea7 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 20:48:24 -0700 Subject: [PATCH 31/88] More getMockBuilder in place of getMock --- .../application/JApplicationWebTest.php | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/tests/unit/suites/libraries/joomla/application/JApplicationWebTest.php b/tests/unit/suites/libraries/joomla/application/JApplicationWebTest.php index cffc912f5f349..45eebdf0b9d69 100644 --- a/tests/unit/suites/libraries/joomla/application/JApplicationWebTest.php +++ b/tests/unit/suites/libraries/joomla/application/JApplicationWebTest.php @@ -844,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') From 2605e7d1c2442d6e606f28143db75c33acb7b5ae Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 21:08:23 -0700 Subject: [PATCH 32/88] Use getMockBuilder rather than getMock directly --- .../libraries/joomla/feed/JFeedParserTest.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php b/tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php index e3e76983c58c0..abe796c1f9459 100644 --- a/tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php +++ b/tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php @@ -41,12 +41,12 @@ 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(array('foo' => 'bar'))) + ->setMockClassName(array($this->_reader)) + ->getMock(); // Setup some expectations for the mock object. $parser->expects($this->once())->method('initialise'); @@ -81,7 +81,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 +184,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); From 683f6e8c0c38cb90298e463221cab2246c858417 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 21:32:59 -0700 Subject: [PATCH 33/88] Use getMockBuilder rather than getMock directly --- .../unit/suites/libraries/joomla/http/JHttpTest.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/unit/suites/libraries/joomla/http/JHttpTest.php b/tests/unit/suites/libraries/joomla/http/JHttpTest.php index ad3b4df5b0c0e..1b1ecfbe15739 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->getMock('JHttpTransportStream', array('request'), array($this->options), 'CustomTransport' . $classNumber ++, false); + $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); } From 2318eaccbda7eab8e2d6c7b4808c29851183216a Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 21:51:44 -0700 Subject: [PATCH 34/88] Use getMockBuilder rather than getMock directly --- tests/unit/suites/libraries/joomla/mail/JMailTest.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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() ) From 008c64e59867a976f7cdd809934892429b35b577 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 21:59:34 -0700 Subject: [PATCH 35/88] Fix testParse mock Constructor Args --- tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php b/tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php index abe796c1f9459..5492296658406 100644 --- a/tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php +++ b/tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php @@ -44,8 +44,7 @@ public function testParse() // Build the mock so we can verify calls. $parser = $this->getMockBuilder('JFeedParserMock') ->setMethods(array('initialise', 'processElement')) - ->setConstructorArgs(array(array('foo' => 'bar'))) - ->setMockClassName(array($this->_reader)) + ->setConstructorArgs(array($this->_reader)) ->getMock(); // Setup some expectations for the mock object. From 85ef7597ecc18036cc10a5bf196386871bd23569 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Wed, 23 Nov 2016 22:16:07 -0700 Subject: [PATCH 36/88] Use getMockBuilder rather than getMock directly --- .../joomla/table/JTableNestedTest.php | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/tests/unit/suites/libraries/joomla/table/JTableNestedTest.php b/tests/unit/suites/libraries/joomla/table/JTableNestedTest.php index c67b366f8eb5f..e308a2286400f 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.'); @@ -601,11 +600,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 +723,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( From fa89e7f9e7557a78a14b127509a6b049a70fe1ee Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 07:55:14 -0700 Subject: [PATCH 37/88] Use getMockBuilder rather than getMock directly --- tests/unit/suites/libraries/joomla/user/JUserTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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() ) From 95bea9828513b6c9d1b89958fc610b55ac319eb9 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 08:01:38 -0700 Subject: [PATCH 38/88] Use getMockBuilder rather than getMock directly --- tests/unit/suites/libraries/legacy/model/JModelLegacyTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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'); From b37fbd626bae4d1086cdd4d6c2de6b786d9e504b Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 08:11:56 -0700 Subject: [PATCH 39/88] Use getMockBuilder rather than getMock directly --- .../mysqli/JDatabaseImporterMysqliTest.php | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/tests/unit/suites/database/driver/mysqli/JDatabaseImporterMysqliTest.php b/tests/unit/suites/database/driver/mysqli/JDatabaseImporterMysqliTest.php index b8d537664cc4c..c5ffbb95b0b60 100644 --- a/tests/unit/suites/database/driver/mysqli/JDatabaseImporterMysqliTest.php +++ b/tests/unit/suites/database/driver/mysqli/JDatabaseImporterMysqliTest.php @@ -46,22 +46,20 @@ 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('') + ->getMock(); $this->dbo->expects( $this->any() From 18e7afeb21bda5cfe9a3e695ebfdd5ba9c8f9256 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 08:15:53 -0700 Subject: [PATCH 40/88] Use getMockBuilder rather than getMock directly --- .../JDatabaseExporterPdomysqlTest.php | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/tests/unit/suites/database/driver/pdomysql/JDatabaseExporterPdomysqlTest.php b/tests/unit/suites/database/driver/pdomysql/JDatabaseExporterPdomysqlTest.php index 6dc79aa3f5f77..6503235798d9a 100644 --- a/tests/unit/suites/database/driver/pdomysql/JDatabaseExporterPdomysqlTest.php +++ b/tests/unit/suites/database/driver/pdomysql/JDatabaseExporterPdomysqlTest.php @@ -34,21 +34,19 @@ 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('') + ->getMock(); $this->dbo->expects( $this->any() From 30fa80144234ebfb5420ec5469cdcaa4057d28db Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 08:18:03 -0700 Subject: [PATCH 41/88] Use getMockBuilder rather than getMock directly --- .../JDatabaseImporterPdomysqlTest.php | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/tests/unit/suites/database/driver/pdomysql/JDatabaseImporterPdomysqlTest.php b/tests/unit/suites/database/driver/pdomysql/JDatabaseImporterPdomysqlTest.php index 11fcb698e5f2e..977bba314ea7d 100644 --- a/tests/unit/suites/database/driver/pdomysql/JDatabaseImporterPdomysqlTest.php +++ b/tests/unit/suites/database/driver/pdomysql/JDatabaseImporterPdomysqlTest.php @@ -55,22 +55,20 @@ 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('') + ->getMock(); $this->dbo->expects( $this->any() From 6f7db3c0f2a38c767c87f53b24816d4544c77538 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 08:22:29 -0700 Subject: [PATCH 42/88] Use getMockBuilder rather than getMock directly --- .../JDatabaseImporterPostgresqlTest.php | 42 +++++++++---------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/tests/unit/suites/database/driver/postgresql/JDatabaseImporterPostgresqlTest.php b/tests/unit/suites/database/driver/postgresql/JDatabaseImporterPostgresqlTest.php index 3e67ac3ae3491..cc5c3c0ef6a33 100644 --- a/tests/unit/suites/database/driver/postgresql/JDatabaseImporterPostgresqlTest.php +++ b/tests/unit/suites/database/driver/postgresql/JDatabaseImporterPostgresqlTest.php @@ -31,28 +31,26 @@ 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('') + ->getMock(); $this->dbo->expects( $this->any() From 608d12ce74376a8550ab70ef2bd264edfef40431 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 08:27:06 -0700 Subject: [PATCH 43/88] disableOriginalConstructor --- .../driver/postgresql/JDatabaseImporterPostgresqlTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/suites/database/driver/postgresql/JDatabaseImporterPostgresqlTest.php b/tests/unit/suites/database/driver/postgresql/JDatabaseImporterPostgresqlTest.php index cc5c3c0ef6a33..b66cd5fc7abbc 100644 --- a/tests/unit/suites/database/driver/postgresql/JDatabaseImporterPostgresqlTest.php +++ b/tests/unit/suites/database/driver/postgresql/JDatabaseImporterPostgresqlTest.php @@ -50,6 +50,7 @@ public function setup() )) ->setConstructorArgs(array()) ->setMockClassName('') + ->disableOriginalConstructor() ->getMock(); $this->dbo->expects( From be5be8acd2c37cdc216e9f622333ea4dbb360408 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 08:27:42 -0700 Subject: [PATCH 44/88] disableOriginalConstructor() --- .../database/driver/pdomysql/JDatabaseImporterPdomysqlTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/suites/database/driver/pdomysql/JDatabaseImporterPdomysqlTest.php b/tests/unit/suites/database/driver/pdomysql/JDatabaseImporterPdomysqlTest.php index 977bba314ea7d..c1dd1537d3da1 100644 --- a/tests/unit/suites/database/driver/pdomysql/JDatabaseImporterPdomysqlTest.php +++ b/tests/unit/suites/database/driver/pdomysql/JDatabaseImporterPdomysqlTest.php @@ -68,6 +68,7 @@ public function setup() )) ->setConstructorArgs(array()) ->setMockClassName('') + ->disableOriginalConstructor() ->getMock(); $this->dbo->expects( From 2229d90c6a381c1034612341635cd2e308653073 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 08:28:02 -0700 Subject: [PATCH 45/88] disableOriginalConstructor() --- .../database/driver/pdomysql/JDatabaseExporterPdomysqlTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/suites/database/driver/pdomysql/JDatabaseExporterPdomysqlTest.php b/tests/unit/suites/database/driver/pdomysql/JDatabaseExporterPdomysqlTest.php index 6503235798d9a..87d79d3de0562 100644 --- a/tests/unit/suites/database/driver/pdomysql/JDatabaseExporterPdomysqlTest.php +++ b/tests/unit/suites/database/driver/pdomysql/JDatabaseExporterPdomysqlTest.php @@ -46,6 +46,7 @@ public function setup() )) ->setConstructorArgs(array()) ->setMockClassName('') + ->disableOriginalConstructor() ->getMock(); $this->dbo->expects( From 41d447465e435d54d29ad4cb9cfbddfdc1fd88a3 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 08:28:31 -0700 Subject: [PATCH 46/88] disableOriginalConstructor() --- .../database/driver/mysqli/JDatabaseImporterMysqliTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/suites/database/driver/mysqli/JDatabaseImporterMysqliTest.php b/tests/unit/suites/database/driver/mysqli/JDatabaseImporterMysqliTest.php index c5ffbb95b0b60..64680b0200b03 100644 --- a/tests/unit/suites/database/driver/mysqli/JDatabaseImporterMysqliTest.php +++ b/tests/unit/suites/database/driver/mysqli/JDatabaseImporterMysqliTest.php @@ -59,6 +59,7 @@ public function setup() )) ->setConstructorArgs(array()) ->setMockClassName('') + ->disableOriginalConstructor() ->getMock(); $this->dbo->expects( From 26c3692fb5602c581a1d4dd589d1ac2f3a4e946c Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 10:14:11 -0700 Subject: [PATCH 47/88] Use getMockBuilder rather than getMock directly --- .../suites/administrator/includes/JAdministratorHelperTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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') From 914832f4ba0aa32279b0841b7e6e9b3be8764266 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 10:19:59 -0700 Subject: [PATCH 48/88] Use getMockBuilder rather than getMock directly --- .../joomla/crypt/password/JCryptPasswordSimpleTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/suites/libraries/joomla/crypt/password/JCryptPasswordSimpleTest.php b/tests/unit/suites/libraries/joomla/crypt/password/JCryptPasswordSimpleTest.php index 5a9c3255c140f..42ace9c51bf4a 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()) From f3c6427d99d9c3292abeafdc5e0b8fd497a888e1 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 10:23:08 -0700 Subject: [PATCH 49/88] another spot for getMockBuilder --- .../joomla/crypt/password/JCryptPasswordSimpleTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/suites/libraries/joomla/crypt/password/JCryptPasswordSimpleTest.php b/tests/unit/suites/libraries/joomla/crypt/password/JCryptPasswordSimpleTest.php index 42ace9c51bf4a..ce8e08c7cec44 100644 --- a/tests/unit/suites/libraries/joomla/crypt/password/JCryptPasswordSimpleTest.php +++ b/tests/unit/suites/libraries/joomla/crypt/password/JCryptPasswordSimpleTest.php @@ -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); From 5115137c739d4a7f61b9f601f7de0dbb53ddb67f Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 10:29:02 -0700 Subject: [PATCH 50/88] Use getMockBuilder rather than getMock directly --- .../suites/libraries/joomla/event/JEventTest.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 From 7a2043aeb8dce9f383eead16a42600ec212b497c Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 10:32:46 -0700 Subject: [PATCH 51/88] Use getMockBuilder rather than getMock directly --- .../suites/libraries/joomla/facebook/JFacebookAlbumTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From c5d17418e1e5dad5e142947da80fd4cdc1d162a7 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 10:37:20 -0700 Subject: [PATCH 52/88] Use getMockBuilder rather than getMock directly --- .../suites/libraries/joomla/facebook/JFacebookCheckinTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 4d8ff499562147061e74c30d891a0dbef74011e0 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 10:38:45 -0700 Subject: [PATCH 53/88] Use getMockBuilder rather than getMock directly --- .../suites/libraries/joomla/facebook/JFacebookCommentTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From fc51c643c583116b76c3548b012e5eb2adbd584a Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 10:45:42 -0700 Subject: [PATCH 54/88] Use getMockBuilder rather than getMock directly --- .../suites/libraries/joomla/facebook/JFacebookEventTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 569287cd5fd210b3fcb4b3a411fe5acc4be2f33d Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 17:18:32 -0700 Subject: [PATCH 55/88] Use getMockBuilder rather than getMock directly --- .../suites/libraries/joomla/facebook/JFacebookGroupTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From add3066f3780d1e2c3e09f01d8d004a6958a9bcd Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 17:19:54 -0700 Subject: [PATCH 56/88] Use getMockBuilder rather than getMock directly --- .../unit/suites/libraries/joomla/facebook/JFacebookLinkTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 383b5377f69432dddc3bc2374cff96acda1799cd Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 17:48:56 -0700 Subject: [PATCH 57/88] Use getMockBuilder rather than getMock directly --- .../unit/suites/libraries/joomla/facebook/JFacebookNoteTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 07e57ac8c727a257c557c7fc874bbc0ae277c7f1 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 17:51:53 -0700 Subject: [PATCH 58/88] Use getMockBuilder rather than getMock directly --- .../suites/libraries/joomla/facebook/JFacebookOauthTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 1fac14b2a36d7c8d14da4891c8182ba60baa5863 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 17:53:21 -0700 Subject: [PATCH 59/88] Use getMockBuilder rather than getMock directly --- .../suites/libraries/joomla/facebook/JFacebookObjectTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From b7d4476ac9305b29fef080c830c747eff24c57f9 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 17:58:34 -0700 Subject: [PATCH 60/88] Use getMockBuilder rather than getMock directly --- .../suites/libraries/joomla/facebook/JFacebookPhotoTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 88581f592108d3c8ee8ab39b99ab18bbd72685a4 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 17:59:56 -0700 Subject: [PATCH 61/88] Use getMockBuilder rather than getMock directly --- .../unit/suites/libraries/joomla/facebook/JFacebookPostTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 35935678c255be403a370f0273d9cb0640941e67 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 18:00:54 -0700 Subject: [PATCH 62/88] Use getMockBuilder rather than getMock directly --- .../suites/libraries/joomla/facebook/JFacebookStatusTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 1a47a2caf23de6aab53eecab7a2389af9865f600 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 18:03:48 -0700 Subject: [PATCH 63/88] Use getMockBuilder rather than getMock directly --- tests/unit/suites/libraries/joomla/facebook/JFacebookTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From f9c11a01b9402174027f10e61c05be1cdae2d4d3 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 18:06:00 -0700 Subject: [PATCH 64/88] Use getMockBuilder rather than getMock directly --- .../unit/suites/libraries/joomla/facebook/JFacebookUserTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 6a8a38374e90fc42f3090baa2fd904bbc7395be1 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 18:10:17 -0700 Subject: [PATCH 65/88] Use getMockBuilder rather than getMock directly --- .../suites/libraries/joomla/facebook/JFacebookVideoTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 3ebf141f15ab5e506aa967b6bd7c59aff9333c05 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 18:33:36 -0700 Subject: [PATCH 66/88] Use getMockBuilder rather than getMock directly --- .../suites/libraries/joomla/github/JGithubAccountTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); } From 76eb2916a6a9ca1b282e12aeb387905acc4dee40 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 18:46:31 -0700 Subject: [PATCH 67/88] Use getMockBuilder rather than getMock directly --- .../suites/libraries/joomla/github/JGithubCommitsTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); } From 644f75c02e4aee0102b2509e5d2866754ecbc2a0 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 24 Nov 2016 18:49:08 -0700 Subject: [PATCH 68/88] Use getMockBuilder rather than getMock directly --- tests/unit/suites/libraries/joomla/github/JGithubForksTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } From 2014f7e53b3a5a1f1227c7cb92456b6b73471717 Mon Sep 17 00:00:00 2001 From: photodude Date: Thu, 24 Nov 2016 19:22:04 -0700 Subject: [PATCH 69/88] Use getMockBuilder rather than getMock directly --- tests/unit/suites/libraries/joomla/github/JGithubGistsTest.php | 2 +- tests/unit/suites/libraries/joomla/github/JGithubHooksTest.php | 2 +- tests/unit/suites/libraries/joomla/github/JGithubIssuesTest.php | 2 +- tests/unit/suites/libraries/joomla/github/JGithubMetaTest.php | 2 +- .../suites/libraries/joomla/github/JGithubMilestonesTest.php | 2 +- tests/unit/suites/libraries/joomla/github/JGithubObjectTest.php | 2 +- .../joomla/github/JGithubPackageAuthorizationsTest.php | 2 +- .../suites/libraries/joomla/github/JGithubPackageGistsTest.php | 2 +- .../suites/libraries/joomla/github/JGithubPackageIssuesTest.php | 2 +- .../suites/libraries/joomla/github/JGithubPackagePullsTest.php | 2 +- tests/unit/suites/libraries/joomla/github/JGithubPullsTest.php | 2 +- tests/unit/suites/libraries/joomla/github/JGithubRefsTest.php | 2 +- .../unit/suites/libraries/joomla/github/JGithubStatusesTest.php | 2 +- tests/unit/suites/libraries/joomla/github/JGithubTest.php | 2 +- .../github/activity/JGithubPackageActivityNotificationsTest.php | 2 +- .../github/activity/JGithubPackageActivityStarringTest.php | 2 +- .../github/activity/JGithubPackageActivityWatchingTest.php | 2 +- .../joomla/github/data/JGithubPackageDataBlobsTest.php | 2 +- .../joomla/github/data/JGithubPackageDataCommitsTest.php | 2 +- .../libraries/joomla/github/data/JGithubPackageDataTagsTest.php | 2 +- .../joomla/github/data/JGithubPackageDataTreesTest.php | 2 +- .../joomla/github/issues/JGithubPackageIssuesCommentsTest.php | 2 +- .../joomla/github/issues/JGithubPackageIssuesEventsTest.php | 2 +- .../joomla/github/issues/JGithubPackageIssuesLabelsTest.php | 2 +- .../joomla/github/issues/JGithubPackageIssuesMilestonesTest.php | 2 +- .../github/repositories/JGithubPackageRepositoriesForksTest.php | 2 +- .../github/repositories/JGithubPackageRepositoriesHooksTest.php | 2 +- .../github/repositories/JGithubPackageRepositoriesKeysTest.php | 2 +- .../repositories/JGithubPackageRepositoriesMergingTest.php | 2 +- .../repositories/JGithubPackageRepositoriesStatusesTest.php | 2 +- 30 files changed, 30 insertions(+), 30 deletions(-) diff --git a/tests/unit/suites/libraries/joomla/github/JGithubGistsTest.php b/tests/unit/suites/libraries/joomla/github/JGithubGistsTest.php index 006129fbada1d..aec307f19a5ba 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubGistsTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubGistsTest.php @@ -66,7 +66,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->response = $this->getMock('JHttpResponse'); $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..08e74af2bac59 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubHooksTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubHooksTest.php @@ -65,7 +65,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->response = $this->getMock('JHttpResponse'); $this->object = new JGithubHooks($this->options, $this->client); diff --git a/tests/unit/suites/libraries/joomla/github/JGithubIssuesTest.php b/tests/unit/suites/libraries/joomla/github/JGithubIssuesTest.php index 42283ee4af33b..3a16f350c00f2 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubIssuesTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubIssuesTest.php @@ -66,7 +66,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->response = $this->getMock('JHttpResponse'); $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..7891781c98cd5 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubMetaTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubMetaTest.php @@ -65,7 +65,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->response = $this->getMock('JHttpResponse'); $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/JGithubPackageIssuesTest.php b/tests/unit/suites/libraries/joomla/github/JGithubPackageIssuesTest.php index adce939f548c1..3c2aa742feb73 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubPackageIssuesTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageIssuesTest.php @@ -66,7 +66,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->response = $this->getMock('JHttpResponse'); $this->object = new JGithubPackageIssues($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/JGithubPullsTest.php b/tests/unit/suites/libraries/joomla/github/JGithubPullsTest.php index 0310a2ed3b821..24ecc5e1c710c 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubPullsTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubPullsTest.php @@ -66,7 +66,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->response = $this->getMock('JHttpResponse'); $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/activity/JGithubPackageActivityNotificationsTest.php b/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityNotificationsTest.php index 27ebdfb6ee942..b047ea5a429a6 100644 --- a/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityNotificationsTest.php +++ b/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityNotificationsTest.php @@ -49,7 +49,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->response = $this->getMock('JHttpResponse'); $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..d35e31185b522 100644 --- a/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityStarringTest.php +++ b/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityStarringTest.php @@ -49,7 +49,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->response = $this->getMock('JHttpResponse'); $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..7acf8b822ca3d 100644 --- a/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityWatchingTest.php +++ b/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityWatchingTest.php @@ -49,7 +49,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->response = $this->getMock('JHttpResponse'); $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..e1d226ecb5d36 100644 --- a/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataBlobsTest.php +++ b/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataBlobsTest.php @@ -49,7 +49,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->response = $this->getMock('JHttpResponse'); $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..3f13858a2e2ab 100644 --- a/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataCommitsTest.php +++ b/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataCommitsTest.php @@ -49,7 +49,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->response = $this->getMock('JHttpResponse'); $this->object = new JGithubPackageDataCommits($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..50f03a4b08bf1 100644 --- a/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataTagsTest.php +++ b/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataTagsTest.php @@ -49,7 +49,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->response = $this->getMock('JHttpResponse'); $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..80f869b5a6c42 100644 --- a/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataTreesTest.php +++ b/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataTreesTest.php @@ -49,7 +49,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->response = $this->getMock('JHttpResponse'); $this->object = new JGithubPackageDataTrees($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..eb7d4195f98f7 100644 --- a/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesCommentsTest.php +++ b/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesCommentsTest.php @@ -49,7 +49,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->response = $this->getMock('JHttpResponse'); $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..e052ac19bd408 100644 --- a/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesEventsTest.php +++ b/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesEventsTest.php @@ -49,7 +49,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->response = $this->getMock('JHttpResponse'); $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..ddb60d8d703c9 100644 --- a/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesLabelsTest.php +++ b/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesLabelsTest.php @@ -49,7 +49,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->response = $this->getMock('JHttpResponse'); $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/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..bde4b059611c5 100644 --- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesHooksTest.php +++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesHooksTest.php @@ -65,7 +65,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->response = $this->getMock('JHttpResponse'); $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..e7df2d967eb07 100644 --- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesKeysTest.php +++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesKeysTest.php @@ -53,7 +53,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->response = $this->getMock('JHttpResponse'); $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..d6b2dbe2603d9 100644 --- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesMergingTest.php +++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesMergingTest.php @@ -53,7 +53,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->response = $this->getMock('JHttpResponse'); $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); } From 6af8d23b5f45ceb0831e92c56f8366c4b155dc27 Mon Sep 17 00:00:00 2001 From: photodude Date: Thu, 24 Nov 2016 19:42:35 -0700 Subject: [PATCH 70/88] Use getMockBuilder rather than getMock directly --- tests/unit/suites/libraries/joomla/github/JGithubHooksTest.php | 2 +- tests/unit/suites/libraries/joomla/github/JGithubIssuesTest.php | 2 +- tests/unit/suites/libraries/joomla/github/JGithubMetaTest.php | 2 +- .../libraries/joomla/github/JGithubPackageGitignoreTest.php | 2 +- .../suites/libraries/joomla/github/JGithubPackageIssuesTest.php | 2 +- .../libraries/joomla/github/JGithubPackageMarkdownTest.php | 2 +- .../suites/libraries/joomla/github/JGithubPackageOrgsTest.php | 2 +- .../libraries/joomla/github/JGithubPackageRepositoriesTest.php | 2 +- .../suites/libraries/joomla/github/JGithubPackageSearchTest.php | 2 +- .../suites/libraries/joomla/github/JGithubPackageUsersTest.php | 2 +- tests/unit/suites/libraries/joomla/github/JGithubPullsTest.php | 2 +- tests/unit/suites/libraries/joomla/github/JGithubUsersTest.php | 2 +- .../github/activity/JGithubPackageActivityNotificationsTest.php | 2 +- .../github/activity/JGithubPackageActivityStarringTest.php | 2 +- .../github/activity/JGithubPackageActivityWatchingTest.php | 2 +- .../joomla/github/data/JGithubPackageDataBlobsTest.php | 2 +- .../joomla/github/data/JGithubPackageDataCommitsTest.php | 2 +- .../libraries/joomla/github/data/JGithubPackageDataRefsTest.php | 2 +- .../libraries/joomla/github/data/JGithubPackageDataTagsTest.php | 2 +- .../joomla/github/data/JGithubPackageDataTreesTest.php | 2 +- .../joomla/github/issues/JGithubPackageIssuesAssigneesTest.php | 2 +- .../joomla/github/issues/JGithubPackageIssuesCommentsTest.php | 2 +- .../joomla/github/issues/JGithubPackageIssuesEventsTest.php | 2 +- .../joomla/github/issues/JGithubPackageIssuesLabelsTest.php | 2 +- .../joomla/github/orgs/JGithubPackageOrgsMembersTest.php | 2 +- .../joomla/github/orgs/JGithubPackageOrgsTeamsTest.php | 2 +- .../joomla/github/pulls/JGithubPackagePullsCommentsTest.php | 2 +- .../JGithubPackageRepositoriesCollaboratorsTest.php | 2 +- .../repositories/JGithubPackageRepositoriesCommentsTest.php | 2 +- .../repositories/JGithubPackageRepositoriesContentsTest.php | 2 +- .../repositories/JGithubPackageRepositoriesDownloadsTest.php | 2 +- .../github/repositories/JGithubPackageRepositoriesHooksTest.php | 2 +- .../github/repositories/JGithubPackageRepositoriesKeysTest.php | 2 +- .../repositories/JGithubPackageRepositoriesMergingTest.php | 2 +- .../joomla/github/users/JGithubPackageUsersEmailsTest.php | 2 +- .../joomla/github/users/JGithubPackageUsersFollowersTest.php | 2 +- .../joomla/github/users/JGithubPackageUsersKeysTest.php | 2 +- 37 files changed, 37 insertions(+), 37 deletions(-) diff --git a/tests/unit/suites/libraries/joomla/github/JGithubHooksTest.php b/tests/unit/suites/libraries/joomla/github/JGithubHooksTest.php index 08e74af2bac59..6859141996bd3 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubHooksTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubHooksTest.php @@ -66,7 +66,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock(); - $this->response = $this->getMock('JHttpResponse'); + $this->response = $this->getMockBuilder('JHttpResponse')->getMock(); $this->object = new JGithubHooks($this->options, $this->client); } diff --git a/tests/unit/suites/libraries/joomla/github/JGithubIssuesTest.php b/tests/unit/suites/libraries/joomla/github/JGithubIssuesTest.php index 3a16f350c00f2..099206cde522c 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubIssuesTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubIssuesTest.php @@ -67,7 +67,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock(); - $this->response = $this->getMock('JHttpResponse'); + $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 7891781c98cd5..7d3ea462c6346 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubMetaTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubMetaTest.php @@ -66,7 +66,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock(); - $this->response = $this->getMock('JHttpResponse'); + $this->response = $this->getMockBuilder('JHttpResponse')->getMock(); $this->object = new JGithubMeta($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..3e03fbf37b775 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubPackageGitignoreTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageGitignoreTest.php @@ -54,7 +54,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put')); - $this->response = $this->getMock('JHttpResponse'); + $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 3c2aa742feb73..c8baa58baffe9 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubPackageIssuesTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageIssuesTest.php @@ -67,7 +67,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock(); - $this->response = $this->getMock('JHttpResponse'); + $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..e6f01682fa940 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubPackageMarkdownTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageMarkdownTest.php @@ -37,7 +37,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put')); - $this->response = $this->getMock('JHttpResponse'); + $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..0529fec792fa5 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubPackageOrgsTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageOrgsTest.php @@ -53,7 +53,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put')); - $this->response = $this->getMock('JHttpResponse'); + $this->response = $this->getMockBuilder('JHttpResponse')->getMock(); $this->object = new JGithubPackageOrgs($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..fcefc84c3c74e 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubPackageRepositoriesTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageRepositoriesTest.php @@ -53,7 +53,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put')); - $this->response = $this->getMock('JHttpResponse'); + $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..e00ab18d07966 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubPackageSearchTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageSearchTest.php @@ -53,7 +53,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put')); - $this->response = $this->getMock('JHttpResponse'); + $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..97a8100e4ea53 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubPackageUsersTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageUsersTest.php @@ -61,7 +61,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put')); - $this->response = $this->getMock('JHttpResponse'); + $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 24ecc5e1c710c..44a6eb0d575b7 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubPullsTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubPullsTest.php @@ -67,7 +67,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock(); - $this->response = $this->getMock('JHttpResponse'); + $this->response = $this->getMockBuilder('JHttpResponse')->getMock(); $this->object = new JGithubPackagePulls($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..aa37eacf88266 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubUsersTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubUsersTest.php @@ -55,7 +55,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put')); - $this->response = $this->getMock('JHttpResponse'); + $this->response = $this->getMockBuilder('JHttpResponse')->getMock(); $this->object = new JGithubPackageUsers($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 b047ea5a429a6..c9b182fd412fa 100644 --- a/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityNotificationsTest.php +++ b/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityNotificationsTest.php @@ -50,7 +50,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock(); - $this->response = $this->getMock('JHttpResponse'); + $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 d35e31185b522..fac40a6676ec4 100644 --- a/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityStarringTest.php +++ b/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityStarringTest.php @@ -50,7 +50,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock(); - $this->response = $this->getMock('JHttpResponse'); + $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 7acf8b822ca3d..a974f55c5d7bf 100644 --- a/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityWatchingTest.php +++ b/tests/unit/suites/libraries/joomla/github/activity/JGithubPackageActivityWatchingTest.php @@ -50,7 +50,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock(); - $this->response = $this->getMock('JHttpResponse'); + $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 e1d226ecb5d36..4c64c7a9c165e 100644 --- a/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataBlobsTest.php +++ b/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataBlobsTest.php @@ -50,7 +50,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock(); - $this->response = $this->getMock('JHttpResponse'); + $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 3f13858a2e2ab..8de4a8df1cbee 100644 --- a/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataCommitsTest.php +++ b/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataCommitsTest.php @@ -50,7 +50,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock(); - $this->response = $this->getMock('JHttpResponse'); + $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..c2d0a253cd064 100644 --- a/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataRefsTest.php +++ b/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataRefsTest.php @@ -67,7 +67,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put')); - $this->response = $this->getMock('JHttpResponse'); + $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 50f03a4b08bf1..5626b054c38af 100644 --- a/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataTagsTest.php +++ b/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataTagsTest.php @@ -50,7 +50,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock(); - $this->response = $this->getMock('JHttpResponse'); + $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 80f869b5a6c42..f93db7caee828 100644 --- a/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataTreesTest.php +++ b/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataTreesTest.php @@ -50,7 +50,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock(); - $this->response = $this->getMock('JHttpResponse'); + $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..a813504722bf2 100644 --- a/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesAssigneesTest.php +++ b/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesAssigneesTest.php @@ -41,7 +41,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put')); - $this->response = $this->getMock('JHttpResponse'); + $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 eb7d4195f98f7..0b165efaa5165 100644 --- a/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesCommentsTest.php +++ b/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesCommentsTest.php @@ -50,7 +50,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock(); - $this->response = $this->getMock('JHttpResponse'); + $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 e052ac19bd408..7db4e8491b22e 100644 --- a/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesEventsTest.php +++ b/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesEventsTest.php @@ -50,7 +50,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock(); - $this->response = $this->getMock('JHttpResponse'); + $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 ddb60d8d703c9..b05afaa857208 100644 --- a/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesLabelsTest.php +++ b/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesLabelsTest.php @@ -50,7 +50,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock(); - $this->response = $this->getMock('JHttpResponse'); + $this->response = $this->getMockBuilder('JHttpResponse')->getMock(); $this->object = new JGithubPackageIssuesLabels($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..def0e96d24e45 100644 --- a/tests/unit/suites/libraries/joomla/github/orgs/JGithubPackageOrgsMembersTest.php +++ b/tests/unit/suites/libraries/joomla/github/orgs/JGithubPackageOrgsMembersTest.php @@ -53,7 +53,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put')); - $this->response = $this->getMock('JHttpResponse'); + $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..22d058304ef63 100644 --- a/tests/unit/suites/libraries/joomla/github/orgs/JGithubPackageOrgsTeamsTest.php +++ b/tests/unit/suites/libraries/joomla/github/orgs/JGithubPackageOrgsTeamsTest.php @@ -53,7 +53,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put')); - $this->response = $this->getMock('JHttpResponse'); + $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..de9cfe76341bf 100644 --- a/tests/unit/suites/libraries/joomla/github/pulls/JGithubPackagePullsCommentsTest.php +++ b/tests/unit/suites/libraries/joomla/github/pulls/JGithubPackagePullsCommentsTest.php @@ -49,7 +49,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put')); - $this->response = $this->getMock('JHttpResponse'); + $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..be7832ce46a5c 100644 --- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesCollaboratorsTest.php +++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesCollaboratorsTest.php @@ -53,7 +53,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put')); - $this->response = $this->getMock('JHttpResponse'); + $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..41ff8cc363e42 100644 --- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesCommentsTest.php +++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesCommentsTest.php @@ -53,7 +53,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put')); - $this->response = $this->getMock('JHttpResponse'); + $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..a4436171c7ee1 100644 --- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesContentsTest.php +++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesContentsTest.php @@ -53,7 +53,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put')); - $this->response = $this->getMock('JHttpResponse'); + $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..4b6fb0f3c15c7 100644 --- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesDownloadsTest.php +++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesDownloadsTest.php @@ -53,7 +53,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put')); - $this->response = $this->getMock('JHttpResponse'); + $this->response = $this->getMockBuilder('JHttpResponse')->getMock(); $this->object = new JGithubPackageRepositoriesDownloads($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 bde4b059611c5..d756fc4b208f4 100644 --- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesHooksTest.php +++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesHooksTest.php @@ -66,7 +66,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock(); - $this->response = $this->getMock('JHttpResponse'); + $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 e7df2d967eb07..ccc548576c0f4 100644 --- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesKeysTest.php +++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesKeysTest.php @@ -54,7 +54,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock(); - $this->response = $this->getMock('JHttpResponse'); + $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 d6b2dbe2603d9..c91b56d32f62b 100644 --- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesMergingTest.php +++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesMergingTest.php @@ -54,7 +54,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock(); - $this->response = $this->getMock('JHttpResponse'); + $this->response = $this->getMockBuilder('JHttpResponse')->getMock(); $this->object = new JGithubPackageRepositoriesMerging($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..c5d4fcad60431 100644 --- a/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersEmailsTest.php +++ b/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersEmailsTest.php @@ -53,7 +53,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put')); - $this->response = $this->getMock('JHttpResponse'); + $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..3a9787b94753a 100644 --- a/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersFollowersTest.php +++ b/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersFollowersTest.php @@ -53,7 +53,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put')); - $this->response = $this->getMock('JHttpResponse'); + $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..5db713c1edcc3 100644 --- a/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersKeysTest.php +++ b/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersKeysTest.php @@ -53,7 +53,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMock('JGithubHttp', array('get', 'post', 'delete', 'patch', 'put')); - $this->response = $this->getMock('JHttpResponse'); + $this->response = $this->getMockBuilder('JHttpResponse')->getMock(); $this->object = new JGithubPackageUsersKeys($this->options, $this->client); } From 0287ad8fcb0a24633d2e93ee79e7edf199c843cd Mon Sep 17 00:00:00 2001 From: photodude Date: Thu, 24 Nov 2016 19:46:35 -0700 Subject: [PATCH 71/88] Use getMockBuilder rather than getMock directly --- tests/unit/suites/libraries/joomla/github/JGithubGistsTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/suites/libraries/joomla/github/JGithubGistsTest.php b/tests/unit/suites/libraries/joomla/github/JGithubGistsTest.php index aec307f19a5ba..a29c497a4bcdb 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubGistsTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubGistsTest.php @@ -67,7 +67,7 @@ protected function setUp() $this->options = new JRegistry; $this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock(); - $this->response = $this->getMock('JHttpResponse'); + $this->response = $this->getMockBuilder('JHttpResponse')->getMock(); $this->object = new JGithubPackageGists($this->options, $this->client); } From b92ad2d2c7d01380663614665c545f7f789baa81 Mon Sep 17 00:00:00 2001 From: photodude Date: Thu, 24 Nov 2016 19:56:26 -0700 Subject: [PATCH 72/88] Use getMockBuilder rather than getMock directly --- .../libraries/joomla/github/JGithubPackageGitignoreTest.php | 2 +- .../libraries/joomla/github/JGithubPackageMarkdownTest.php | 2 +- .../suites/libraries/joomla/github/JGithubPackageOrgsTest.php | 2 +- .../libraries/joomla/github/JGithubPackageRepositoriesTest.php | 2 +- .../suites/libraries/joomla/github/JGithubPackageSearchTest.php | 2 +- .../suites/libraries/joomla/github/JGithubPackageUsersTest.php | 2 +- .../joomla/github/issues/JGithubPackageIssuesAssigneesTest.php | 2 +- .../joomla/github/orgs/JGithubPackageOrgsMembersTest.php | 2 +- .../joomla/github/orgs/JGithubPackageOrgsTeamsTest.php | 2 +- .../joomla/github/pulls/JGithubPackagePullsCommentsTest.php | 2 +- .../JGithubPackageRepositoriesCollaboratorsTest.php | 2 +- .../repositories/JGithubPackageRepositoriesCommentsTest.php | 2 +- .../repositories/JGithubPackageRepositoriesContentsTest.php | 2 +- .../repositories/JGithubPackageRepositoriesDownloadsTest.php | 2 +- .../joomla/github/users/JGithubPackageUsersEmailsTest.php | 2 +- .../joomla/github/users/JGithubPackageUsersFollowersTest.php | 2 +- .../joomla/github/users/JGithubPackageUsersKeysTest.php | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/unit/suites/libraries/joomla/github/JGithubPackageGitignoreTest.php b/tests/unit/suites/libraries/joomla/github/JGithubPackageGitignoreTest.php index 3e03fbf37b775..2c4f03067b792 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubPackageGitignoreTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageGitignoreTest.php @@ -53,7 +53,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->response = $this->getMockBuilder('JHttpResponse')->getMock(); $this->object = new JGithubPackageGitignore($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 e6f01682fa940..a98d5f621bee8 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubPackageMarkdownTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageMarkdownTest.php @@ -36,7 +36,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->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 0529fec792fa5..8bcbca43ba83d 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubPackageOrgsTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageOrgsTest.php @@ -52,7 +52,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->response = $this->getMockBuilder('JHttpResponse')->getMock(); $this->object = new JGithubPackageOrgs($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 fcefc84c3c74e..d930eb2d607a0 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubPackageRepositoriesTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageRepositoriesTest.php @@ -52,7 +52,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->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 e00ab18d07966..bd2b36673b48b 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubPackageSearchTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageSearchTest.php @@ -52,7 +52,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->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 97a8100e4ea53..9d87506513641 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubPackageUsersTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubPackageUsersTest.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->response = $this->getMockBuilder('JHttpResponse')->getMock(); $this->object = new JGithubPackageUsers($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 a813504722bf2..418bea24a8da3 100644 --- a/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesAssigneesTest.php +++ b/tests/unit/suites/libraries/joomla/github/issues/JGithubPackageIssuesAssigneesTest.php @@ -40,7 +40,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->response = $this->getMockBuilder('JHttpResponse')->getMock(); $this->object = new JGithubPackageIssuesAssignees($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 def0e96d24e45..7e81a0aeec53b 100644 --- a/tests/unit/suites/libraries/joomla/github/orgs/JGithubPackageOrgsMembersTest.php +++ b/tests/unit/suites/libraries/joomla/github/orgs/JGithubPackageOrgsMembersTest.php @@ -52,7 +52,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->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 22d058304ef63..ef220076cb700 100644 --- a/tests/unit/suites/libraries/joomla/github/orgs/JGithubPackageOrgsTeamsTest.php +++ b/tests/unit/suites/libraries/joomla/github/orgs/JGithubPackageOrgsTeamsTest.php @@ -52,7 +52,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->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 de9cfe76341bf..86b2145fdd0e8 100644 --- a/tests/unit/suites/libraries/joomla/github/pulls/JGithubPackagePullsCommentsTest.php +++ b/tests/unit/suites/libraries/joomla/github/pulls/JGithubPackagePullsCommentsTest.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->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 be7832ce46a5c..5f98edb94d02b 100644 --- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesCollaboratorsTest.php +++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesCollaboratorsTest.php @@ -52,7 +52,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->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 41ff8cc363e42..d07730e5251f9 100644 --- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesCommentsTest.php +++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesCommentsTest.php @@ -52,7 +52,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->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 a4436171c7ee1..5f902e129c5d8 100644 --- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesContentsTest.php +++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesContentsTest.php @@ -52,7 +52,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->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 4b6fb0f3c15c7..3c343a83ae894 100644 --- a/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesDownloadsTest.php +++ b/tests/unit/suites/libraries/joomla/github/repositories/JGithubPackageRepositoriesDownloadsTest.php @@ -52,7 +52,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->response = $this->getMockBuilder('JHttpResponse')->getMock(); $this->object = new JGithubPackageRepositoriesDownloads($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 c5d4fcad60431..92f0862df0b62 100644 --- a/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersEmailsTest.php +++ b/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersEmailsTest.php @@ -52,7 +52,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->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 3a9787b94753a..78f40d51adaf3 100644 --- a/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersFollowersTest.php +++ b/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersFollowersTest.php @@ -52,7 +52,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->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 5db713c1edcc3..8019647f34f7c 100644 --- a/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersKeysTest.php +++ b/tests/unit/suites/libraries/joomla/github/users/JGithubPackageUsersKeysTest.php @@ -52,7 +52,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->response = $this->getMockBuilder('JHttpResponse')->getMock(); $this->object = new JGithubPackageUsersKeys($this->options, $this->client); From 4338317dc068247152106df2dc0324ba777704b3 Mon Sep 17 00:00:00 2001 From: photodude Date: Thu, 24 Nov 2016 20:06:42 -0700 Subject: [PATCH 73/88] Use getMockBuilder rather than getMock directly --- .../suites/libraries/joomla/github/JGithubHttpTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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); } From 790b1dea0869c43e3f3b4b7e7e3a8f64b5c8956e Mon Sep 17 00:00:00 2001 From: photodude Date: Thu, 24 Nov 2016 20:17:33 -0700 Subject: [PATCH 74/88] Use getMockBuilder rather than getMock directly --- tests/unit/suites/libraries/joomla/github/JGithubUsersTest.php | 2 +- .../joomla/github/activity/JGithubPackageActivityEventsTest.php | 2 +- .../libraries/joomla/github/data/JGithubPackageDataRefsTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/suites/libraries/joomla/github/JGithubUsersTest.php b/tests/unit/suites/libraries/joomla/github/JGithubUsersTest.php index aa37eacf88266..bcf9bf2e287ca 100644 --- a/tests/unit/suites/libraries/joomla/github/JGithubUsersTest.php +++ b/tests/unit/suites/libraries/joomla/github/JGithubUsersTest.php @@ -54,7 +54,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->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/data/JGithubPackageDataRefsTest.php b/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataRefsTest.php index c2d0a253cd064..74945dc5f9b3e 100644 --- a/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataRefsTest.php +++ b/tests/unit/suites/libraries/joomla/github/data/JGithubPackageDataRefsTest.php @@ -66,7 +66,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->response = $this->getMockBuilder('JHttpResponse')->getMock(); $this->object = new JGithubPackageDataRefs($this->options, $this->client); From 0faf6ffd31554d4ee6f5871e69d9e6553b334905 Mon Sep 17 00:00:00 2001 From: photodude Date: Thu, 24 Nov 2016 20:30:06 -0700 Subject: [PATCH 75/88] Use getMockBuilder rather than getMock directly --- .../suites/libraries/joomla/google/JGoogleAuthOauth2Test.php | 5 ++++- .../libraries/joomla/google/JGoogleDataAdsenseTest.php | 5 ++++- .../libraries/joomla/google/JGoogleDataCalendarTest.php | 5 ++++- .../libraries/joomla/google/JGoogleDataPicasaAlbumTest.php | 5 ++++- .../libraries/joomla/google/JGoogleDataPicasaPhotoTest.php | 5 ++++- .../suites/libraries/joomla/google/JGoogleDataPicasaTest.php | 5 ++++- .../joomla/google/JGoogleDataPlusActivitiesTest.php | 5 ++++- .../libraries/joomla/google/JGoogleDataPlusCommentsTest.php | 5 ++++- .../libraries/joomla/google/JGoogleDataPlusPeopleTest.php | 5 ++++- .../suites/libraries/joomla/google/JGoogleDataPlusTest.php | 5 ++++- tests/unit/suites/libraries/joomla/google/JGoogleTest.php | 5 ++++- 11 files changed, 44 insertions(+), 11 deletions(-) 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/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); From c85de30b38b9e96450cb6b008de885755cba8267 Mon Sep 17 00:00:00 2001 From: photodude Date: Thu, 24 Nov 2016 20:51:45 -0700 Subject: [PATCH 76/88] remove duplicate $this->transport --- tests/unit/suites/libraries/joomla/http/JHttpTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/suites/libraries/joomla/http/JHttpTest.php b/tests/unit/suites/libraries/joomla/http/JHttpTest.php index 1b1ecfbe15739..48b3242da6629 100644 --- a/tests/unit/suites/libraries/joomla/http/JHttpTest.php +++ b/tests/unit/suites/libraries/joomla/http/JHttpTest.php @@ -47,12 +47,12 @@ protected function setUp() parent::setUp(); static $classNumber = 1; + // Build the mock object. $this->options = $this->getMockBuilder('\\Joomla\\Registry\\Registry') ->setMethods(array('get', 'set')) ->getMock(); - $this->transport = $this->getMock('JHttpTransportStream', array('request'), array($this->options), 'CustomTransport' . $classNumber ++, false); $this->transport = $this->getMockBuilder('JHttpTransportStream') ->setMethods(array('request')) ->setConstructorArgs(array($this->options)) From 214325134afd91b2f90cc66449f22e35ef843dec Mon Sep 17 00:00:00 2001 From: photodude Date: Thu, 24 Nov 2016 21:28:39 -0700 Subject: [PATCH 77/88] Use getMockBuilder rather than getMock directly --- .../suites/libraries/joomla/google/JGoogleEmbedMapsTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); } From ffe74c54e578cb7aea829a25d5eb2cebd37b2432 Mon Sep 17 00:00:00 2001 From: photodude Date: Thu, 24 Nov 2016 21:44:12 -0700 Subject: [PATCH 78/88] Use getMockBuilder rather than getMock directly --- .../libraries/joomla/linkedin/JLinkedinCommunicationsTest.php | 2 +- .../suites/libraries/joomla/linkedin/JLinkedinCompaniesTest.php | 2 +- .../suites/libraries/joomla/linkedin/JLinkedinGroupsTest.php | 2 +- .../unit/suites/libraries/joomla/linkedin/JLinkedinJobsTest.php | 2 +- .../suites/libraries/joomla/linkedin/JLinkedinOAuthTest.php | 2 +- .../suites/libraries/joomla/linkedin/JLinkedinObjectTest.php | 2 +- .../suites/libraries/joomla/linkedin/JLinkedinPeopleTest.php | 2 +- .../suites/libraries/joomla/linkedin/JLinkedinStreamTest.php | 2 +- tests/unit/suites/libraries/joomla/linkedin/JLinkedinTest.php | 2 +- tests/unit/suites/libraries/joomla/oauth1/JOAuth1ClientTest.php | 2 +- .../joomla/openstreetmap/JOpenstreetmapChangesetsTest.php | 2 +- .../joomla/openstreetmap/JOpenstreetmapElementsTest.php | 2 +- .../libraries/joomla/openstreetmap/JOpenstreetmapGpsTest.php | 2 +- .../libraries/joomla/openstreetmap/JOpenstreetmapInfoTest.php | 2 +- .../libraries/joomla/openstreetmap/JOpenstreetmapOauthTest.php | 2 +- .../libraries/joomla/openstreetmap/JOpenstreetmapObjectTest.php | 2 +- .../libraries/joomla/openstreetmap/JOpenstreetmapTest.php | 2 +- .../libraries/joomla/openstreetmap/JOpenstreetmapUserTest.php | 2 +- .../unit/suites/libraries/joomla/twitter/JTwitterBlockTest.php | 2 +- .../libraries/joomla/twitter/JTwitterDirectmessagesTest.php | 2 +- .../suites/libraries/joomla/twitter/JTwitterFavoritesTest.php | 2 +- .../suites/libraries/joomla/twitter/JTwitterFriendsTest.php | 2 +- tests/unit/suites/libraries/joomla/twitter/JTwitterHelpTest.php | 2 +- .../unit/suites/libraries/joomla/twitter/JTwitterListsTest.php | 2 +- .../unit/suites/libraries/joomla/twitter/JTwitterOauthTest.php | 2 +- .../unit/suites/libraries/joomla/twitter/JTwitterObjectTest.php | 2 +- .../unit/suites/libraries/joomla/twitter/JTwitterPlacesTest.php | 2 +- .../suites/libraries/joomla/twitter/JTwitterProfileTest.php | 2 +- .../unit/suites/libraries/joomla/twitter/JTwitterSearchTest.php | 2 +- .../suites/libraries/joomla/twitter/JTwitterStatusesTest.php | 2 +- tests/unit/suites/libraries/joomla/twitter/JTwitterTest.php | 2 +- .../unit/suites/libraries/joomla/twitter/JTwitterTrendsTest.php | 2 +- .../unit/suites/libraries/joomla/twitter/JTwitterUsersTest.php | 2 +- 33 files changed, 33 insertions(+), 33 deletions(-) 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/oauth1/JOAuth1ClientTest.php b/tests/unit/suites/libraries/joomla/oauth1/JOAuth1ClientTest.php index 8770b788def0c..2c83cbb1bd68f 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(); 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/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); From f1096602ab7e659662c42b93c8db8ff37a0f60b7 Mon Sep 17 00:00:00 2001 From: photodude Date: Thu, 24 Nov 2016 21:57:24 -0700 Subject: [PATCH 79/88] Use getMockBuilder rather than getMock directly --- .../mediawiki/JMediawikiCategoriesTest.php | 426 +++++++++--------- .../joomla/mediawiki/JMediawikiImagesTest.php | 338 +++++++------- .../joomla/mediawiki/JMediawikiLinksTest.php | 426 +++++++++--------- .../joomla/mediawiki/JMediawikiObjectTest.php | 194 ++++---- .../joomla/mediawiki/JMediawikiPagesTest.php | 320 ++++++------- .../joomla/mediawiki/JMediawikiSearchTest.php | 250 +++++----- .../joomla/mediawiki/JMediawikiSitesTest.php | 338 +++++++------- .../joomla/mediawiki/JMediawikiTest.php | 378 ++++++++-------- .../joomla/mediawiki/JMediawikiUsersTest.php | 278 ++++++------ 9 files changed, 1474 insertions(+), 1474 deletions(-) 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/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; + } +} From 44926b4080f598aad02e69e7365e974d75e3a925 Mon Sep 17 00:00:00 2001 From: photodude Date: Thu, 24 Nov 2016 22:22:02 -0700 Subject: [PATCH 80/88] Use getMockBuilder rather than getMock directly --- .../joomla/mediawiki/JMediawikiHttpTest.php | 247 +++++++++--------- .../joomla/oauth2/JOauth2ClientTest.php | 5 +- .../libraries/joomla/session/JSessionTest.php | 2 +- 3 files changed, 131 insertions(+), 123 deletions(-) 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/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/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()) From 9de5f6bfdc49f2a50950c51b1f3a8d7ae4e59a04 Mon Sep 17 00:00:00 2001 From: photodude Date: Thu, 24 Nov 2016 23:00:59 -0700 Subject: [PATCH 81/88] Use getMockBuilder rather than getMock directly --- .../suites/libraries/joomla/form/JFormTest.php | 2 +- .../form/fields/JFormFieldCheckboxesTest.php | 14 +++++++------- .../libraries/joomla/oauth1/JOAuth1ClientTest.php | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/unit/suites/libraries/joomla/form/JFormTest.php b/tests/unit/suites/libraries/joomla/form/JFormTest.php index ccbe49793acee..374227d90dc6e 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/oauth1/JOAuth1ClientTest.php b/tests/unit/suites/libraries/joomla/oauth1/JOAuth1ClientTest.php index 2c83cbb1bd68f..f96c238cbddae 100644 --- a/tests/unit/suites/libraries/joomla/oauth1/JOAuth1ClientTest.php +++ b/tests/unit/suites/libraries/joomla/oauth1/JOAuth1ClientTest.php @@ -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) { From 7e5cc80eb5dc76b6caa37bdd553f2911d3b0ad95 Mon Sep 17 00:00:00 2001 From: photodude Date: Thu, 24 Nov 2016 23:08:11 -0700 Subject: [PATCH 82/88] Use getMockBuilder rather than getMock directly --- tests/unit/suites/libraries/joomla/http/JHttpTransportTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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'); } } From 3f1040b1c95a2c86882c376ff08dac1429c7fdc9 Mon Sep 17 00:00:00 2001 From: photodude Date: Thu, 24 Nov 2016 23:29:57 -0700 Subject: [PATCH 83/88] Use getMockBuilder rather than getMock directly --- .../mysql/JDatabaseImporterMysqlTest.php | 31 +++++++++---------- .../renderer/JDocumentRendererAtomTest.php | 16 +++------- .../renderer/JDocumentRendererRSSTest.php | 16 +++------- .../joomla/table/JTableNestedTest.php | 9 +++--- 4 files changed, 27 insertions(+), 45 deletions(-) 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/libraries/joomla/document/feed/renderer/JDocumentRendererAtomTest.php b/tests/unit/suites/libraries/joomla/document/feed/renderer/JDocumentRendererAtomTest.php index 05d3aef4e4b21..a8b80e8ede0b5 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..ba73e6345bdbd 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/table/JTableNestedTest.php b/tests/unit/suites/libraries/joomla/table/JTableNestedTest.php index e308a2286400f..f37bd3e94e6e9 100644 --- a/tests/unit/suites/libraries/joomla/table/JTableNestedTest.php +++ b/tests/unit/suites/libraries/joomla/table/JTableNestedTest.php @@ -348,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.'); From 52b3848cbbe7b61002acd515ccae532b95876fa0 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Fri, 25 Nov 2016 15:02:02 -0700 Subject: [PATCH 84/88] Add 'setUserState' to MockApplicationCms Fixes 2 warnings on phpUnit 5.6: 1) JModelListTest::testGetuserstateUsesDefault Trying to configure method "setUserState" which cannot be configured because it does not exist, has not been specified, is final, or is static 2) JModelListTest::testGetuserstateUsesRequestData Trying to configure method "setUserState" which cannot be configured because it does not exist, has not been specified, is final, or is static --- tests/unit/core/mock/application/cms.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit/core/mock/application/cms.php b/tests/unit/core/mock/application/cms.php index 14a43577b6b3b..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()); From 18c103106770bf1465bec1aacf751d318780b963 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Sat, 26 Nov 2016 11:08:37 -0700 Subject: [PATCH 85/88] mockDatabase fails for mockTableExtension on hhvm Fixes 10 hhvm failures that have one of the following messages ```php UnexpectedValueException: No columns found for #__extensions table Expectation failed for method name is equal to when invoked 1 time(s). Method was expected to be called 1 times, actually called 0 times. ``` --- .../suites/libraries/cms/installer/JInstallerAdapterTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/suites/libraries/cms/installer/JInstallerAdapterTest.php b/tests/unit/suites/libraries/cms/installer/JInstallerAdapterTest.php index 210b005bc3bd6..26d52e326e835 100644 --- a/tests/unit/suites/libraries/cms/installer/JInstallerAdapterTest.php +++ b/tests/unit/suites/libraries/cms/installer/JInstallerAdapterTest.php @@ -94,7 +94,7 @@ public function testCheckExistingExtensionForExistingExtension() // Set up a mock JTableExtension $mockTableExtension = $this->getMockBuilder('JTableExtension') ->setMethods(array('find', 'load')) - ->setConstructorArgs(array($this->getMockDatabase())) + ->setConstructorArgs(array(self::$driver)) ->getMock(); // A set of data for an extension From 0e9fd59590f3a1ff494433a494985efdad3cab7a Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Fri, 9 Dec 2016 09:37:58 -0700 Subject: [PATCH 86/88] cs-fix extra semicolon --- tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php b/tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php index 5492296658406..f83fd2d76dd9f 100644 --- a/tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php +++ b/tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php @@ -183,7 +183,7 @@ public function testProcessElementWithEntry() public function testFetchNamespace() { // Set a mock namespace into the namespaces for the parser object. - $mock = $this->getMockBuilder('JFeedParserNamespace')->getMock();; + $mock = $this->getMockBuilder('JFeedParserNamespace')->getMock(); $namespaces = array('mock' => $mock); TestReflection::setValue($this->_instance, 'namespaces', $namespaces); From ad8af695b64d43b00c3c6d191b207e03f516a050 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Fri, 9 Dec 2016 09:59:20 -0700 Subject: [PATCH 87/88] remove trailing coma --- .../joomla/document/feed/renderer/JDocumentRendererAtomTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a8b80e8ede0b5..87d202fb2344d 100644 --- a/tests/unit/suites/libraries/joomla/document/feed/renderer/JDocumentRendererAtomTest.php +++ b/tests/unit/suites/libraries/joomla/document/feed/renderer/JDocumentRendererAtomTest.php @@ -48,7 +48,7 @@ protected function setUp() $this->saveFactoryState(); JFactory::$application = $this->getMockBuilder('JApplication') - ->setMethods(array('get', 'getCfg', 'getRouter',)) + ->setMethods(array('get', 'getCfg', 'getRouter')) ->getMock(); JFactory::$application From 144c6a9591a7e36ed0291ea2cad813c75caa9acd Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Fri, 9 Dec 2016 10:01:59 -0700 Subject: [PATCH 88/88] remove trailing comma --- .../joomla/document/feed/renderer/JDocumentRendererRSSTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ba73e6345bdbd..a643675fed5a5 100644 --- a/tests/unit/suites/libraries/joomla/document/feed/renderer/JDocumentRendererRSSTest.php +++ b/tests/unit/suites/libraries/joomla/document/feed/renderer/JDocumentRendererRSSTest.php @@ -48,7 +48,7 @@ protected function setUp() $this->saveFactoryState(); JFactory::$application = $this->getMockBuilder('JApplication') - ->setMethods(array('get', 'getCfg', 'getRouter',)) + ->setMethods(array('get', 'getCfg', 'getRouter')) ->getMock(); JFactory::$application