diff --git a/tests/Zend/Acl/AclTest.php b/tests/Zend/Acl/AclTest.php index f114de90..b0cb2245 100644 --- a/tests/Zend/Acl/AclTest.php +++ b/tests/Zend/Acl/AclTest.php @@ -88,7 +88,7 @@ public function testRoleRegistryRemoveOneNonExistent() $this->_acl->removeRole('nonexistent'); $this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon removing a non-existent Role'); } catch (Zend_Acl_Role_Registry_Exception $e) { - $this->assertContains('not found', $e->getMessage()); + $this->assertStringContainsString('not found', $e->getMessage()); } } @@ -112,7 +112,7 @@ public function testRoleRegistryAddInheritsNonExistent() $this->_acl->addRole(new Zend_Acl_Role('guest'), 'nonexistent'); $this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon specifying a non-existent parent'); } catch (Zend_Acl_Role_Registry_Exception $e) { - $this->assertContains('does not exist', $e->getMessage()); + $this->assertStringContainsString('does not exist', $e->getMessage()); } } @@ -128,14 +128,14 @@ public function testRoleRegistryInheritsNonExistent() $this->_acl->inheritsRole('nonexistent', $roleGuest); $this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon specifying a non-existent child Role'); } catch (Zend_Acl_Role_Registry_Exception $e) { - $this->assertContains('not found', $e->getMessage()); + $this->assertStringContainsString('not found', $e->getMessage()); } try { $this->_acl->inheritsRole($roleGuest, 'nonexistent'); $this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon specifying a non-existent parent Role'); } catch (Zend_Acl_Role_Registry_Exception $e) { - $this->assertContains('not found', $e->getMessage()); + $this->assertStringContainsString('not found', $e->getMessage()); } } @@ -210,7 +210,7 @@ public function testRoleRegistryDuplicate() ->add($roleGuest); $this->fail('Expected exception not thrown upon adding same Role twice'); } catch (Zend_Acl_Role_Registry_Exception $e) { - $this->assertContains('already exists', $e->getMessage()); + $this->assertStringContainsString('already exists', $e->getMessage()); } } @@ -228,7 +228,7 @@ public function testRoleRegistryDuplicateId() ->add($roleGuest2); $this->fail('Expected exception not thrown upon adding two Roles with same ID'); } catch (Zend_Acl_Role_Registry_Exception $e) { - $this->assertContains('already exists', $e->getMessage()); + $this->assertStringContainsString('already exists', $e->getMessage()); } } @@ -291,7 +291,7 @@ public function testResourceRemoveOneNonExistent() $this->_acl->remove('nonexistent'); $this->fail('Expected Zend_Acl_Exception not thrown upon removing a non-existent Resource'); } catch (Zend_Acl_Exception $e) { - $this->assertContains('not found', $e->getMessage()); + $this->assertStringContainsString('not found', $e->getMessage()); } } @@ -315,7 +315,7 @@ public function testResourceAddInheritsNonExistent() $this->_acl->add(new Zend_Acl_Resource('area'), 'nonexistent'); $this->fail('Expected Zend_Acl_Exception not thrown upon specifying a non-existent parent'); } catch (Zend_Acl_Exception $e) { - $this->assertContains('does not exist', $e->getMessage()); + $this->assertStringContainsString('does not exist', $e->getMessage()); } } @@ -331,14 +331,14 @@ public function testResourceInheritsNonExistent() $this->_acl->inherits('nonexistent', $resourceArea); $this->fail('Expected Zend_Acl_Exception not thrown upon specifying a non-existent child Resource'); } catch (Zend_Acl_Exception $e) { - $this->assertContains('not found', $e->getMessage()); + $this->assertStringContainsString('not found', $e->getMessage()); } try { $this->_acl->inherits($resourceArea, 'nonexistent'); $this->fail('Expected Zend_Acl_Exception not thrown upon specifying a non-existent parent Resource'); } catch (Zend_Acl_Exception $e) { - $this->assertContains('not found', $e->getMessage()); + $this->assertStringContainsString('not found', $e->getMessage()); } } @@ -374,7 +374,7 @@ public function testResourceDuplicate() ->add($resourceArea); $this->fail('Expected exception not thrown upon adding same Resource twice'); } catch (Zend_Acl_Exception $e) { - $this->assertContains('already exists', $e->getMessage()); + $this->assertStringContainsString('already exists', $e->getMessage()); } } @@ -390,7 +390,7 @@ public function testResourceDuplicateId() ->add($resourceArea2); $this->fail('Expected exception not thrown upon adding two Resources with same ID'); } catch (Zend_Acl_Exception $e) { - $this->assertContains('already exists', $e->getMessage()); + $this->assertStringContainsString('already exists', $e->getMessage()); } } @@ -403,14 +403,14 @@ public function testIsAllowedNonExistent() $this->_acl->isAllowed('nonexistent'); $this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon non-existent Role'); } catch (Zend_Acl_Role_Registry_Exception $e) { - $this->assertContains('not found', $e->getMessage()); + $this->assertStringContainsString('not found', $e->getMessage()); } try { $this->_acl->isAllowed(null, 'nonexistent'); $this->fail('Expected Zend_Acl_Exception not thrown upon non-existent Resource'); } catch (Zend_Acl_Exception $e) { - $this->assertContains('not found', $e->getMessage()); + $this->assertStringContainsString('not found', $e->getMessage()); } } @@ -719,7 +719,7 @@ public function testRuleRoleRemove() $this->_acl->isAllowed('guest'); $this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon isAllowed() on non-existent Role'); } catch (Zend_Acl_Role_Registry_Exception $e) { - $this->assertContains('not found', $e->getMessage()); + $this->assertStringContainsString('not found', $e->getMessage()); } $this->_acl->addRole(new Zend_Acl_Role('guest')); $this->assertFalse($this->_acl->isAllowed('guest')); @@ -739,7 +739,7 @@ public function testRuleRoleRemoveAll() $this->_acl->isAllowed('guest'); $this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon isAllowed() on non-existent Role'); } catch (Zend_Acl_Role_Registry_Exception $e) { - $this->assertContains('not found', $e->getMessage()); + $this->assertStringContainsString('not found', $e->getMessage()); } $this->_acl->addRole(new Zend_Acl_Role('guest')); $this->assertFalse($this->_acl->isAllowed('guest')); @@ -759,7 +759,7 @@ public function testRulesResourceRemove() $this->_acl->isAllowed(null, 'area'); $this->fail('Expected Zend_Acl_Exception not thrown upon isAllowed() on non-existent Resource'); } catch (Zend_Acl_Exception $e) { - $this->assertContains('not found', $e->getMessage()); + $this->assertStringContainsString('not found', $e->getMessage()); } $this->_acl->add(new Zend_Acl_Resource('area')); $this->assertFalse($this->_acl->isAllowed(null, 'area')); @@ -779,7 +779,7 @@ public function testRulesResourceRemoveAll() $this->_acl->isAllowed(null, 'area'); $this->fail('Expected Zend_Acl_Exception not thrown upon isAllowed() on non-existent Resource'); } catch (Zend_Acl_Exception $e) { - $this->assertContains('not found', $e->getMessage()); + $this->assertStringContainsString('not found', $e->getMessage()); } $this->_acl->add(new Zend_Acl_Resource('area')); $this->assertFalse($this->_acl->isAllowed(null, 'area')); @@ -1076,11 +1076,11 @@ protected function _loadUseCase1() /** * Returns an array of registered roles. * - * @expectedException \PHPUnit\Framework\Exception * @group ZF-5638 */ public function testGetRegisteredRoles() { + $this->expectException(\PHPUnit\Framework\Exception::class); $acl = $this->_acl; $acl->addRole('developer'); @@ -1165,13 +1165,13 @@ public function testGetRegisteredRolesIsDeprecated() try { $this->_acl->getRegisteredRoles(); $this->fail('getRegisteredRoles() did not throw an exception'); - } catch (\PHPUnit\Framework\Exception $e) { + } catch (\PHPUnit\Framework\Exception) { self::assertTrue(true); return; } - $this->fail('An expected notice has not been raised'); + static::fail('An expected notice has not been raised'); } /** diff --git a/tests/Zend/AllTests/StreamWrapper/PhpInput.php b/tests/Zend/AllTests/StreamWrapper/PhpInput.php index b8de085c..b365e6b5 100644 --- a/tests/Zend/AllTests/StreamWrapper/PhpInput.php +++ b/tests/Zend/AllTests/StreamWrapper/PhpInput.php @@ -104,7 +104,7 @@ public function stream_eof() return self::$_returnValues[__FUNCTION__]; } - return 0 == strlen(self::$_data); + return 0 == strlen((string) self::$_data); } public function stream_read($count) @@ -117,7 +117,7 @@ public function stream_read($count) // To match the behavior of php://input, we need to clear out the data // as it is read - if ($count > strlen(self::$_data)) { + if ($count > strlen((string) self::$_data)) { $data = self::$_data; self::$_data = ''; } else { diff --git a/tests/Zend/Application/ApplicationTest.php b/tests/Zend/Application/ApplicationTest.php index c6fac5f1..d3e9f9f9 100644 --- a/tests/Zend/Application/ApplicationTest.php +++ b/tests/Zend/Application/ApplicationTest.php @@ -32,7 +32,7 @@ class Zend_Application_ApplicationTest extends \PHPUnit\Framework\TestCase public static function main() { $suite = new \PHPUnit\Framework\TestSuite(self::class); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } public function setUp(): void @@ -175,7 +175,7 @@ public function testPassingIncludePathOptionShouldModifyIncludePath() ), )); $test = get_include_path(); - $this->assertContains($expected, $test); + $this->assertStringContainsString($expected, $test); } public function testPassingPhpSettingsSetsIniValues() @@ -244,11 +244,9 @@ public function testPassingArrayBootstrapOptionShouldRegisterBootstrapBasedOnPat $this->assertTrue($bootstrap instanceof ZfAppBootstrap); } - /** - * @expectedException Zend_Application_Exception - */ public function testPassingArrayBootstrapWithoutPathOptionShouldRaiseException() { + $this->expectException(\Zend_Application_Exception::class); $this->application->setOptions(array( 'bootstrap' => array( 'class' => 'ZfAppBootstrap', @@ -257,22 +255,18 @@ public function testPassingArrayBootstrapWithoutPathOptionShouldRaiseException() $bootstrap = $this->application->getBootstrap(); } - /** - * @expectedException Zend_Application_Exception - */ public function testPassingInvalidBootstrapOptionShouldRaiseException() { + $this->expectException(\Zend_Application_Exception::class); $this->application->setOptions(array( 'bootstrap' => new stdClass(), )); $bootstrap = $this->application->getBootstrap(); } - /** - * @expectedException Zend_Application_Exception - */ public function testPassingInvalidOptionsArgumentToConstructorShouldRaiseException() { + $this->expectException(\Zend_Application_Exception::class); $application = new Zend_Application('testing', new stdClass()); } @@ -331,11 +325,9 @@ public function testPassingArrayOptionsWithConfigKeyShouldLoadOptionsAndNotOverr $this->assertNotEquals('bar', $application->getOption('foo')); } - /** - * @expectedException Zend_Application_Exception - */ public function testPassingInvalidStringOptionToConstructorShouldRaiseException() { + $this->expectException(\Zend_Application_Exception::class); $application = new Zend_Application('testing', __DIR__ . '/_files/appconfig'); } @@ -359,11 +351,9 @@ public function testBootstrapImplementsFluentInterface() $this->assertSame($application, $this->application); } - /** - * @expectedException Zend_Application_Exception - */ public function testApplicationShouldRaiseExceptionIfBootstrapFileDoesNotContainBootstrapClass() { + $this->expectException(\Zend_Application_Exception::class); $this->application->setOptions(array( 'bootstrap' => array( 'path' => __DIR__ . '/_files/ZfAppNoBootstrap.php', @@ -373,11 +363,9 @@ public function testApplicationShouldRaiseExceptionIfBootstrapFileDoesNotContain $bootstrap = $this->application->getBootstrap(); } - /** - * @expectedException Zend_Application_Exception - */ public function testApplicationShouldRaiseExceptionWhenBootstrapClassNotOfCorrectType() { + $this->expectException(\Zend_Application_Exception::class); $this->application->setOptions(array( 'bootstrap' => array( 'path' => __DIR__ . '/_files/ZfAppBadBootstrap.php', diff --git a/tests/Zend/Application/Bootstrap/BootstrapAbstractTest.php b/tests/Zend/Application/Bootstrap/BootstrapAbstractTest.php index 04738d24..a47b12e4 100644 --- a/tests/Zend/Application/Bootstrap/BootstrapAbstractTest.php +++ b/tests/Zend/Application/Bootstrap/BootstrapAbstractTest.php @@ -56,7 +56,7 @@ class Zend_Application_Bootstrap_BootstrapAbstractTest extends \PHPUnit\Framewor public static function main() { $suite = new \PHPUnit\Framework\TestSuite(self::class); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } public function setUp(): void @@ -126,11 +126,9 @@ public function testConstructorShouldAllowPassingAnotherBootstrapObject() $this->assertSame($bootstrap1, $bootstrap2->getApplication()); } - /** - * @expectedException Zend_Application_Bootstrap_Exception - */ public function testConstructorShouldRaiseExceptionForInvalidApplicationArgument() { + $this->expectException(\Zend_Application_Bootstrap_Exception::class); require_once __DIR__ . '/../_files/ZfAppBootstrap.php'; $bootstrap = new ZfAppBootstrap(new stdClass()); } @@ -248,11 +246,9 @@ public function testInternalInitializersShouldRegisterResourceNames() $this->assertEquals($resources, $test); } - /** - * @expectedException Zend_Application_Bootstrap_Exception - */ public function testRegisterPluginResourceShouldThrowExceptionForInvalidResourceType() { + $this->expectException(\Zend_Application_Bootstrap_Exception::class); require_once __DIR__ . '/../_files/ZfAppBootstrap.php'; $bootstrap = new ZfAppBootstrap($this->application); $bootstrap->registerPluginResource(array()); @@ -286,7 +282,7 @@ public function testShouldAllowRegisteringPluginResourceUsingNameOnly() $bootstrap = new ZfAppBootstrap($this->application); $bootstrap->registerPluginResource('view'); $test = $bootstrap->getPluginResource('view'); - $this->assertEquals(\Zend_Application_Resource_View::class, get_class($test)); + $this->assertEquals(\Zend_Application_Resource_View::class, $test::class); } public function testShouldAllowUnregisteringPluginResourcesUsingConcreteInstance() @@ -299,11 +295,9 @@ public function testShouldAllowUnregisteringPluginResourcesUsingConcreteInstance $this->assertFalse($bootstrap->hasPluginResource('view')); } - /** - * @expectedException Zend_Application_Bootstrap_Exception - */ public function testAttemptingToUnregisterPluginResourcesUsingInvalidResourceTypeShouldThrowException() { + $this->expectException(\Zend_Application_Bootstrap_Exception::class); require_once __DIR__ . '/../_files/ZfAppBootstrap.php'; $bootstrap = new ZfAppBootstrap($this->application); $bootstrap->registerPluginResource('view'); @@ -424,21 +418,17 @@ public function testPassingNoValuesToBootstrapExecutesAllResources() $this->assertTrue($bootstrap->executedFoobarResource); } - /** - * @expectedException Zend_Application_Bootstrap_Exception - */ public function testPassingInvalidResourceArgumentToBootstrapShouldThrowException() { + $this->expectException(\Zend_Application_Bootstrap_Exception::class); require_once __DIR__ . '/../_files/ZfAppBootstrap.php'; $bootstrap = new ZfAppBootstrap($this->application); $bootstrap->bootstrap(new stdClass()); } - /** - * @expectedException Zend_Application_Bootstrap_Exception - */ public function testPassingUnknownResourceToBootstrapShouldThrowException() { + $this->expectException(\Zend_Application_Bootstrap_Exception::class); require_once __DIR__ . '/../_files/ZfAppBootstrap.php'; $bootstrap = new ZfAppBootstrap($this->application); $bootstrap->bootstrap('bazbat'); @@ -452,21 +442,17 @@ public function testCallShouldOverloadToBootstrap() $this->assertEquals(1, $bootstrap->fooExecuted); } - /** - * @expectedException Zend_Application_Bootstrap_Exception - */ public function testCallShouldThrowExceptionForInvalidMethodCall() { + $this->expectException(\Zend_Application_Bootstrap_Exception::class); require_once __DIR__ . '/../_files/ZfAppBootstrap.php'; $bootstrap = new ZfAppBootstrap($this->application); $bootstrap->initFoo(); } - /** - * @expectedException Zend_Application_Bootstrap_Exception - */ public function testDependencyTrackingShouldDetectCircularDependencies() { + $this->expectException(\Zend_Application_Bootstrap_Exception::class); require_once __DIR__ . '/../_files/BootstrapBaseCircularDependency.php'; $bootstrap = new BootstrapBaseCircularDependency($this->application); $bootstrap->bootstrap(); @@ -682,6 +668,7 @@ public function testRequestingPluginsByAutoloadableClassNameShouldNotRaiseFatalE $this->application->setOptions($options); $bootstrap = new Zend_Application_Bootstrap_Bootstrap($this->application); $bootstrap->bootstrap(); + self::assertTrue(true); } /** @@ -707,10 +694,10 @@ public function testCallingSetOptionsMultipleTimesShouldUpdateOptionKeys() /** * @group ZF-9110 - * @expectedException Zend_Application_Bootstrap_Exception */ public function testPassingSameBootstrapAsApplicationShouldNotCauseRecursion() { + $this->expectException(\Zend_Application_Bootstrap_Exception::class); $bootstrap = new Zend_Application_Bootstrap_Bootstrap($this->application); $bootstrap->setApplication($bootstrap); } @@ -730,6 +717,7 @@ public function testUsingFallbackAutoloaderWithModulesShouldNotResultInFrontcont $this->application->setOptions($options); $bootstrap = new Zf7696Bootstrap($this->application); $bootstrap->bootstrap(array('modules')); + self::assertTrue(true); } /** diff --git a/tests/Zend/Application/Bootstrap/BootstrapTest.php b/tests/Zend/Application/Bootstrap/BootstrapTest.php index 906c2744..15da689b 100644 --- a/tests/Zend/Application/Bootstrap/BootstrapTest.php +++ b/tests/Zend/Application/Bootstrap/BootstrapTest.php @@ -31,7 +31,7 @@ class Zend_Application_Bootstrap_BootstrapTest extends \PHPUnit\Framework\TestCa public static function main() { $suite = new \PHPUnit\Framework\TestSuite(self::class); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } public function setUp(): void @@ -84,11 +84,9 @@ public function testFrontControllerResourcePluginShouldBeRegisteredByDefault() $this->assertTrue($this->bootstrap->hasPluginResource('FrontController')); } - /** - * @expectedException Zend_Application_Bootstrap_Exception - */ public function testRunShouldRaiseExceptionIfNoControllerDirectoryRegisteredWithFrontController() { + $this->expectException(\Zend_Application_Bootstrap_Exception::class); $this->bootstrap->bootstrap(); $this->bootstrap->run(); } diff --git a/tests/Zend/Application/Module/AutoloaderTest.php b/tests/Zend/Application/Module/AutoloaderTest.php index 84ccfd51..7bfa0c84 100644 --- a/tests/Zend/Application/Module/AutoloaderTest.php +++ b/tests/Zend/Application/Module/AutoloaderTest.php @@ -44,7 +44,7 @@ class Zend_Application_Module_AutoloaderTest extends \PHPUnit\Framework\TestCase public static function main() { $suite = new \PHPUnit\Framework\TestSuite(self::class); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } public function setUp(): void diff --git a/tests/Zend/Application/Module/BootstrapTest.php b/tests/Zend/Application/Module/BootstrapTest.php index 2bd8eb0c..5b383d43 100644 --- a/tests/Zend/Application/Module/BootstrapTest.php +++ b/tests/Zend/Application/Module/BootstrapTest.php @@ -31,7 +31,7 @@ class Zend_Application_Module_BootstrapTest extends \PHPUnit\Framework\TestCase public static function main() { $suite = new \PHPUnit\Framework\TestSuite(self::class); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } public function setUp(): void diff --git a/tests/Zend/Application/Resource/CacheManagerTest.php b/tests/Zend/Application/Resource/CacheManagerTest.php index 0d3fd481..ee1fd925 100644 --- a/tests/Zend/Application/Resource/CacheManagerTest.php +++ b/tests/Zend/Application/Resource/CacheManagerTest.php @@ -51,7 +51,7 @@ class Zend_Application_Resource_CacheManagerTest extends \PHPUnit\Framework\Test public static function main() { $suite = new \PHPUnit\Framework\TestSuite(self::class); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } public function setUp(): void diff --git a/tests/Zend/Application/Resource/FrontcontrollerTest.php b/tests/Zend/Application/Resource/FrontcontrollerTest.php index fa65dd99..ad653097 100644 --- a/tests/Zend/Application/Resource/FrontcontrollerTest.php +++ b/tests/Zend/Application/Resource/FrontcontrollerTest.php @@ -36,7 +36,7 @@ class Zend_Application_Resource_FrontcontrollerTest extends \PHPUnit\Framework\T public static function main() { $suite = new \PHPUnit\Framework\TestSuite(self::class); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } public function setUp(): void @@ -359,7 +359,7 @@ public function testSettingOfRegisterPluginIndexActuallyWorks() $this->assertEquals(count($expected), count($plugins)); foreach ($expected as $index => $class) { - $this->assertEquals($class, get_class($plugins[$index])); + $this->assertEquals($class, $plugins[$index]::class); } } @@ -393,7 +393,7 @@ public function testShouldSetDispatcherFromConfiguration() )); $resource->init(); $front = $resource->getFrontController(); - $this->assertEquals('ZF9724_Dispatcher', get_class($front->getDispatcher())); + $this->assertEquals('ZF9724_Dispatcher', $front->getDispatcher()::class); $this->assertEquals('baz', $front->getDispatcher()->getParam('bar')); } } diff --git a/tests/Zend/Application/Resource/LayoutTest.php b/tests/Zend/Application/Resource/LayoutTest.php index 660906a3..e643b1bd 100644 --- a/tests/Zend/Application/Resource/LayoutTest.php +++ b/tests/Zend/Application/Resource/LayoutTest.php @@ -31,7 +31,7 @@ class Zend_Application_Resource_LayoutTest extends \PHPUnit\Framework\TestCase public static function main() { $suite = new \PHPUnit\Framework\TestSuite(self::class); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } public function setUp(): void diff --git a/tests/Zend/Application/Resource/LocaleTest.php b/tests/Zend/Application/Resource/LocaleTest.php index e6b1c1e0..cd19a2f7 100644 --- a/tests/Zend/Application/Resource/LocaleTest.php +++ b/tests/Zend/Application/Resource/LocaleTest.php @@ -31,7 +31,7 @@ class Zend_Application_Resource_LocaleTest extends \PHPUnit\Framework\TestCase public static function main() { $suite = new \PHPUnit\Framework\TestSuite(self::class); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } public function setUp(): void diff --git a/tests/Zend/Application/Resource/ModulesTest.php b/tests/Zend/Application/Resource/ModulesTest.php index cd94f158..359ec808 100644 --- a/tests/Zend/Application/Resource/ModulesTest.php +++ b/tests/Zend/Application/Resource/ModulesTest.php @@ -31,7 +31,7 @@ class Zend_Application_Resource_ModulesTest extends \PHPUnit\Framework\TestCase public static function main() { $suite = new \PHPUnit\Framework\TestSuite(self::class); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } public function setUp(): void diff --git a/tests/Zend/Application/Resource/NavigationTest.php b/tests/Zend/Application/Resource/NavigationTest.php index 1250cc41..fe3f00ca 100644 --- a/tests/Zend/Application/Resource/NavigationTest.php +++ b/tests/Zend/Application/Resource/NavigationTest.php @@ -31,7 +31,7 @@ class Zend_Application_Resource_NavigationTest extends \PHPUnit\Framework\TestCa public static function main() { $suite = new \PHPUnit\Framework\TestSuite(self::class); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } public function setUp(): void @@ -159,7 +159,7 @@ public function testDefaultPageTypeIsSet() try { $resource->setBootstrap($this->bootstrap)->init(); $this->fail('An exception should have been thrown but wasn\'t'); - } catch (Zend_Exception $e) { + } catch (Zend_Exception) { $this->assertTrue(true); } diff --git a/tests/Zend/Application/Resource/ResourceAbstractTest.php b/tests/Zend/Application/Resource/ResourceAbstractTest.php index 35426879..6c3409c7 100644 --- a/tests/Zend/Application/Resource/ResourceAbstractTest.php +++ b/tests/Zend/Application/Resource/ResourceAbstractTest.php @@ -31,7 +31,7 @@ class Zend_Application_Resource_ResourceAbstractTest extends \PHPUnit\Framework\ public static function main() { $suite = new \PHPUnit\Framework\TestSuite(self::class); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } public function setUp(): void diff --git a/tests/Zend/Application/Resource/RouterTest.php b/tests/Zend/Application/Resource/RouterTest.php index 3e9efc32..984f32d4 100644 --- a/tests/Zend/Application/Resource/RouterTest.php +++ b/tests/Zend/Application/Resource/RouterTest.php @@ -31,7 +31,7 @@ class Zend_Application_Resource_RouterTest extends \PHPUnit\Framework\TestCase public static function main() { $suite = new \PHPUnit\Framework\TestSuite(self::class); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } public function setUp(): void diff --git a/tests/Zend/Application/Resource/SessionTest.php b/tests/Zend/Application/Resource/SessionTest.php index 5eae35cb..6e5a2480 100644 --- a/tests/Zend/Application/Resource/SessionTest.php +++ b/tests/Zend/Application/Resource/SessionTest.php @@ -47,7 +47,7 @@ public function testSetSaveHandler() public function testSetSaveHandlerString() { $saveHandler = $this->createMock(\Zend_Session_SaveHandler_Interface::class); - $saveHandlerClassName = get_class($saveHandler); + $saveHandlerClassName = $saveHandler::class; $this->resource->setSaveHandler($saveHandlerClassName); @@ -57,7 +57,7 @@ public function testSetSaveHandlerString() public function testSetSaveHandlerArray() { $saveHandler = $this->createMock(\Zend_Session_SaveHandler_Interface::class); - $saveHandlerClassName = get_class($saveHandler); + $saveHandlerClassName = $saveHandler::class; $this->resource->setSaveHandler(array('class' => $saveHandlerClassName)); diff --git a/tests/Zend/Application/Resource/UseragentTest.php b/tests/Zend/Application/Resource/UseragentTest.php index 7df4d5cb..f48339a1 100644 --- a/tests/Zend/Application/Resource/UseragentTest.php +++ b/tests/Zend/Application/Resource/UseragentTest.php @@ -31,7 +31,7 @@ class Zend_Application_Resource_UseragentTest extends \PHPUnit\Framework\TestCas public static function main() { $suite = new \PHPUnit\Framework\TestSuite(self::class); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } public function setUp(): void diff --git a/tests/Zend/Application/Resource/ViewTest.php b/tests/Zend/Application/Resource/ViewTest.php index 9c13f50e..aa580e0d 100644 --- a/tests/Zend/Application/Resource/ViewTest.php +++ b/tests/Zend/Application/Resource/ViewTest.php @@ -33,7 +33,7 @@ class Zend_Application_Resource_ViewTest extends \PHPUnit\Framework\TestCase public static function main() { $suite = new \PHPUnit\Framework\TestSuite(self::class); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } public function setUp(): void diff --git a/tests/Zend/Captcha/DumbTest.php b/tests/Zend/Captcha/DumbTest.php index 432aa59e..0395eaa5 100644 --- a/tests/Zend/Captcha/DumbTest.php +++ b/tests/Zend/Captcha/DumbTest.php @@ -31,7 +31,7 @@ class Zend_Captcha_DumbTest extends \PHPUnit\Framework\TestCase public static function main() { $suite = new \PHPUnit\Framework\TestSuite('Zend_Captcha_DumbTest'); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } /** @@ -69,7 +69,7 @@ public function testRendersWordInReverse() $id = $this->captcha->generate('test'); $word = $this->captcha->getWord(); $html = $this->captcha->render(new Zend_View()); - $this->assertContains(strrev($word), $html); + $this->assertStringContainsString(strrev($word), $html); $this->assertNotContains($word, $html); } @@ -99,7 +99,7 @@ public function testRendersLabelUsingProvidedValue() $id = $this->captcha->generate('test'); $html = $this->captcha->render(new Zend_View()); - $this->assertContains('Testing 123', $html); + $this->assertStringContainsString('Testing 123', $html); } } @@ -136,13 +136,8 @@ public function __isset($name) public function __call($method, $args) { - switch ($method) { - case 'setExpirationHops': - case 'setExpirationSeconds': - $this->$method = array_shift($args); - - break; - default: - } + $this->$method = match ($method) { + 'setExpirationHops', 'setExpirationSeconds' => array_shift($args), + }; } } diff --git a/tests/Zend/Captcha/FigletTest.php b/tests/Zend/Captcha/FigletTest.php index b15659b4..82a5dbdd 100644 --- a/tests/Zend/Captcha/FigletTest.php +++ b/tests/Zend/Captcha/FigletTest.php @@ -32,7 +32,7 @@ class Zend_Captcha_FigletTest extends \PHPUnit\Framework\TestCase public static function main() { $suite = new \PHPUnit\Framework\TestSuite('Zend_Captcha_FigletTest'); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } /** @@ -82,7 +82,7 @@ public function getView() public function testCaptchaIsRendered() { $html = $this->element->render($this->getView()); - $this->assertContains($this->element->getName(), $html); + $this->assertStringContainsString($this->element->getName(), $html); } public function testCaptchaHasIdAndInput() @@ -136,7 +136,7 @@ public function testGetWordReturnsWord() $word = $this->captcha->getWord(); $this->assertFalse(empty($word)); $this->assertTrue(is_string($word)); - $this->assertTrue(strlen($word) == 8); + $this->assertTrue(strlen((string) $word) == 8); $this->word = $word; } @@ -146,7 +146,7 @@ public function testGetWordLength() $this->captcha->generate(); $word = $this->captcha->getWord(); $this->assertTrue(is_string($word)); - $this->assertTrue(strlen($word) == 4); + $this->assertTrue(strlen((string) $word) == 4); $this->word = $word; } @@ -329,13 +329,8 @@ public function __isset($name) public function __call($method, $args) { - switch ($method) { - case 'setExpirationHops': - case 'setExpirationSeconds': - $this->$method = array_shift($args); - - break; - default: - } + $this->$method = match ($method) { + 'setExpirationHops', 'setExpirationSeconds' => array_shift($args), + }; } } diff --git a/tests/Zend/Captcha/ImageTest.php b/tests/Zend/Captcha/ImageTest.php index 6bcb93f2..f1398868 100644 --- a/tests/Zend/Captcha/ImageTest.php +++ b/tests/Zend/Captcha/ImageTest.php @@ -33,7 +33,7 @@ class Zend_Captcha_ImageTest extends \PHPUnit\Framework\TestCase public static function main() { $suite = new \PHPUnit\Framework\TestSuite('Zend_Captcha_ImageTest'); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } /** @@ -130,7 +130,7 @@ public function getView() public function testCaptchaIsRendered() { $html = $this->element->render($this->getView()); - $this->assertContains($this->element->getName(), $html); + $this->assertStringContainsString($this->element->getName(), $html); } public function testCaptchaHasIdAndInput() @@ -162,14 +162,14 @@ public function testCaptchaSetSuffix() { $this->captcha->setSuffix('.jpeg'); $html = $this->element->render($this->getView()); - $this->assertContains('.jpeg', $html, $html); + $this->assertStringContainsString('.jpeg', $html, $html); } public function testCaptchaSetImgURL() { $this->captcha->setImgURL('/some/other/URL/'); $html = $this->element->render($this->getView()); - $this->assertContains('/some/other/URL/', $html, $html); + $this->assertStringContainsString('/some/other/URL/', $html, $html); } public function testCaptchaCreatesImage() @@ -199,7 +199,7 @@ public function testGetWordReturnsWord() $word = $this->captcha->getWord(); $this->assertFalse(empty($word)); $this->assertTrue(is_string($word)); - $this->assertTrue(strlen($word) == 8); + $this->assertTrue(strlen((string) $word) == 8); $this->word = $word; } @@ -209,7 +209,7 @@ public function testGetWordLength() $this->captcha->generate(); $word = $this->captcha->getWord(); $this->assertTrue(is_string($word)); - $this->assertTrue(strlen($word) == 4); + $this->assertTrue(strlen((string) $word) == 4); $this->word = $word; } @@ -344,13 +344,8 @@ public function __isset($name) public function __call($method, $args) { - switch ($method) { - case 'setExpirationHops': - case 'setExpirationSeconds': - $this->$method = array_shift($args); - - break; - default: - } + $this->$method = match ($method) { + 'setExpirationHops', 'setExpirationSeconds' => array_shift($args), + }; } } diff --git a/tests/Zend/Config/IniTest.php b/tests/Zend/Config/IniTest.php index 55d63c46..e7262ee6 100644 --- a/tests/Zend/Config/IniTest.php +++ b/tests/Zend/Config/IniTest.php @@ -108,7 +108,7 @@ public function testErrorNoExtendsSection() $config = new Zend_Config_Ini($this->_iniFileConfig, 'extendserror'); $this->fail('An expected Zend_Config_Exception has not been raised'); } catch (Zend_Config_Exception $expected) { - $this->assertContains('cannot be found', $expected->getMessage()); + $this->assertStringContainsString('cannot be found', $expected->getMessage()); } } @@ -120,7 +120,7 @@ public function testInvalidKeys() $config = new Zend_Config_Ini($this->_iniFileConfig, $section); $this->fail('An expected Zend_Config_Exception has not been raised'); } catch (Zend_Config_Exception $expected) { - $this->assertContains('Invalid key', $expected->getMessage()); + $this->assertStringContainsString('Invalid key', $expected->getMessage()); } } } @@ -131,7 +131,7 @@ public function testZF426() $config = new Zend_Config_Ini($this->_iniFileConfig, 'zf426'); $this->fail('An expected Zend_Config_Exception has not been raised'); } catch (Zend_Config_Exception $expected) { - $this->assertContains('Cannot create sub-key for', $expected->getMessage()); + $this->assertStringContainsString('Cannot create sub-key for', $expected->getMessage()); } } @@ -171,7 +171,7 @@ public function testZF415() $config = new Zend_Config_Ini($this->_iniFileCircularConfig, null); $this->fail('An expected Zend_Config_Exception has not been raised'); } catch (Zend_Config_Exception $expected) { - $this->assertContains('circular inheritance', $expected->getMessage()); + $this->assertStringContainsString('circular inheritance', $expected->getMessage()); } } @@ -181,7 +181,7 @@ public function testErrorNoFile() $config = new Zend_Config_Ini('',''); $this->fail('An expected Zend_Config_Exception has not been raised'); } catch (Zend_Config_Exception $expected) { - $this->assertContains('Filename is not set', $expected->getMessage()); + $this->assertStringContainsString('Filename is not set', $expected->getMessage()); } } @@ -192,7 +192,7 @@ public function testErrorMultipleExensions() zend::dump($config); $this->fail('An expected Zend_Config_Exception has not been raised'); } catch (Zend_Config_Exception $expected) { - $this->assertContains('may not extend multiple sections', $expected->getMessage()); + $this->assertStringContainsString('may not extend multiple sections', $expected->getMessage()); } } @@ -202,14 +202,14 @@ public function testErrorNoSectionFound() $config = new Zend_Config_Ini($this->_iniFileConfig,array('all', 'notthere')); $this->fail('An expected Zend_Config_Exception has not been raised'); } catch (Zend_Config_Exception $expected) { - $this->assertContains('cannot be found', $expected->getMessage()); + $this->assertStringContainsString('cannot be found', $expected->getMessage()); } try { $config = new Zend_Config_Ini($this->_iniFileConfig,'notthere'); $this->fail('An expected Zend_Config_Exception has not been raised'); } catch (Zend_Config_Exception $expected) { - $this->assertContains('cannot be found', $expected->getMessage()); + $this->assertStringContainsString('cannot be found', $expected->getMessage()); } } diff --git a/tests/Zend/Config/XmlTest.php b/tests/Zend/Config/XmlTest.php index 8662165e..846e0216 100644 --- a/tests/Zend/Config/XmlTest.php +++ b/tests/Zend/Config/XmlTest.php @@ -88,14 +88,14 @@ public function testErrorNoInitialSection() $config = @new Zend_Config_Xml($this->_xmlFileConfig, 'notthere'); $this->fail('An expected Zend_Config_Exception has not been raised'); } catch (Zend_Config_Exception $expected) { - $this->assertContains('cannot be found in', $expected->getMessage()); + $this->assertStringContainsString('cannot be found in', $expected->getMessage()); } try { $config = @new Zend_Config_Xml($this->_xmlFileConfig, array('notthere', 'all')); $this->fail('An expected Zend_Config_Exception has not been raised'); } catch (Zend_Config_Exception $expected) { - $this->assertContains('cannot be found in', $expected->getMessage()); + $this->assertStringContainsString('cannot be found in', $expected->getMessage()); } } @@ -105,7 +105,7 @@ public function testErrorNoExtendsSection() $config = new Zend_Config_Xml($this->_xmlFileConfig, 'extendserror'); $this->fail('An expected Zend_Config_Exception has not been raised'); } catch (Zend_Config_Exception $expected) { - $this->assertContains('cannot be found', $expected->getMessage()); + $this->assertStringContainsString('cannot be found', $expected->getMessage()); } } @@ -145,7 +145,7 @@ public function testZF415() $config = new Zend_Config_Xml($this->_xmlFileCircularConfig, null); $this->fail('An expected Zend_Config_Exception has not been raised'); } catch (Zend_Config_Exception $expected) { - $this->assertContains('circular inheritance', $expected->getMessage()); + $this->assertStringContainsString('circular inheritance', $expected->getMessage()); } } @@ -155,7 +155,7 @@ public function testErrorNoFile() $config = new Zend_Config_Xml('',null); $this->fail('An expected Zend_Config_Exception has not been raised'); } catch (Zend_Config_Exception $expected) { - $this->assertContains('Filename is not set', $expected->getMessage()); + $this->assertStringContainsString('Filename is not set', $expected->getMessage()); } } @@ -199,14 +199,14 @@ public function testZF3578_InvalidOrMissingfXmlFile() $config = new Zend_Config_Xml($this->_xmlFileInvalid); $this->fail('An expected Zend_Config_Exception has not been raised'); } catch (Zend_Config_Exception $expected) { - $this->assertContains('failed to load', $expected->getMessage()); + $this->assertStringContainsString('failed to load', $expected->getMessage()); } try { $config = new Zend_Config_Xml('I/dont/exist'); $this->fail('An expected Zend_Config_Exception has not been raised'); } catch (Zend_Config_Exception $expected) { - $this->assertContains('doesn\'t exist', $expected->getMessage()); + $this->assertStringContainsString('doesn\'t exist', $expected->getMessage()); } } diff --git a/tests/Zend/ConfigTest.php b/tests/Zend/ConfigTest.php index 082b32dd..a6a1583c 100644 --- a/tests/Zend/ConfigTest.php +++ b/tests/Zend/ConfigTest.php @@ -124,7 +124,7 @@ public function testNoModifications() try { $config->hostname = 'test'; } catch (Zend_Config_Exception $expected) { - static::assertContains('is read only', $expected->getMessage()); + static::assertStringContainsString('is read only', $expected->getMessage()); return; } @@ -138,7 +138,7 @@ public function testNoNestedModifications() try { $config->db->host = 'test'; } catch (Zend_Config_Exception $expected) { - static::assertContains('is read only', $expected->getMessage()); + static::assertStringContainsString('is read only', $expected->getMessage()); return; } @@ -168,14 +168,14 @@ public function testIterator() $var .= "\nkey = $key, value = $value"; } } - $this->assertContains('key = name, value = thisname', $var); + $this->assertStringContainsString('key = name, value = thisname', $var); // 1 nest $var = ''; foreach ($config->db as $key => $value) { $var .= "\nkey = $key, value = $value"; } - $this->assertContains('key = host, value = 127.0.0.1', $var); + $this->assertStringContainsString('key = host, value = 127.0.0.1', $var); // 2 nests $config = new Zend_Config($this->_menuData1); @@ -183,7 +183,7 @@ public function testIterator() foreach ($config->button->b1 as $key => $value) { $var .= "\nkey = $key, value = $value"; } - $this->assertContains('key = L1, value = button1-1', $var); + $this->assertStringContainsString('key = L1, value = button1-1', $var); } public function testArray() @@ -194,9 +194,9 @@ public function testArray() print_r($config->toArray()); $contents = ob_get_clean(); - $this->assertContains('Array', $contents); - $this->assertContains('[hostname] => all', $contents); - $this->assertContains('[user] => username', $contents); + $this->assertStringContainsString('Array', $contents); + $this->assertStringContainsString('[hostname] => all', $contents); + $this->assertStringContainsString('[user] => username', $contents); } public function testErrorWriteToReadOnly() @@ -206,7 +206,7 @@ public function testErrorWriteToReadOnly() try { $config->test = '32'; } catch (Zend_Config_Exception $expected) { - static::assertContains('read only', $expected->getMessage()); + static::assertStringContainsString('read only', $expected->getMessage()); return; } @@ -284,7 +284,7 @@ public function testUnsetException() try { unset($config->hostname); } catch (Zend_Config_Exception $expected) { - static::assertContains('is read only', $expected->getMessage()); + static::assertStringContainsString('is read only', $expected->getMessage()); return; } @@ -371,7 +371,7 @@ public function testSetReadOnly() try { $config->c = 'c'; } catch (Zend_Config_Exception $expected) { - static::assertContains('is read only', $expected->getMessage()); + static::assertStringContainsString('is read only', $expected->getMessage()); return; } diff --git a/tests/Zend/Console/GetoptTest.php b/tests/Zend/Console/GetoptTest.php index 8d5c204d..c8992816 100644 --- a/tests/Zend/Console/GetoptTest.php +++ b/tests/Zend/Console/GetoptTest.php @@ -107,7 +107,7 @@ public function testGetoptExceptionForMissingFlag() $this->fail('Expected to catch Zend_Console_Getopt_Exception'); } catch (Zend_Exception $e) { $this->assertTrue($e instanceof Zend_Console_Getopt_Exception, - 'Expected Zend_Console_Getopt_Exception, got ' . get_class($e)); + 'Expected Zend_Console_Getopt_Exception, got ' . $e::class); $this->assertEquals($e->getMessage(), 'Blank flag not allowed in rule "|a".'); } @@ -121,7 +121,7 @@ public function testGetoptExceptionForDuplicateFlag() $this->fail('Expected to catch Zend_Console_Getopt_Exception'); } catch (Zend_Exception $e) { $this->assertTrue($e instanceof Zend_Console_Getopt_Exception, - 'Expected Zend_Console_Getopt_Exception, got ' . get_class($e)); + 'Expected Zend_Console_Getopt_Exception, got ' . $e::class); $this->assertEquals($e->getMessage(), 'Option "--apple" is being defined more than once.'); } @@ -132,7 +132,7 @@ public function testGetoptExceptionForDuplicateFlag() $this->fail('Expected to catch Zend_Console_Getopt_Exception'); } catch (Zend_Exception $e) { $this->assertTrue($e instanceof Zend_Console_Getopt_Exception, - 'Expected Zend_Console_Getopt_Exception, got ' . get_class($e)); + 'Expected Zend_Console_Getopt_Exception, got ' . $e::class); $this->assertEquals($e->getMessage(), 'Option "-a" is being defined more than once.'); } @@ -152,7 +152,7 @@ public function testGetoptAddRules() $this->fail('Expected to catch Zend_Console_Getopt_Exception'); } catch (Zend_Exception $e) { $this->assertTrue($e instanceof Zend_Console_Getopt_Exception, - 'Expected Zend_Console_Getopt_Exception, got ' . get_class($e)); + 'Expected Zend_Console_Getopt_Exception, got ' . $e::class); $this->assertEquals($e->getMessage(), 'Option "pear" is not recognized.'); } $opts->addRules(array('pear|p=s' => 'Pear option')); @@ -173,7 +173,7 @@ public function testGetoptExceptionMissingParameter() $this->fail('Expected to catch Zend_Console_Getopt_Exception'); } catch (Zend_Exception $e) { $this->assertTrue($e instanceof Zend_Console_Getopt_Exception, - 'Expected Zend_Console_Getopt_Exception, got ' . get_class($e)); + 'Expected Zend_Console_Getopt_Exception, got ' . $e::class); $this->assertEquals($e->getMessage(), 'Option "apple" requires a parameter.'); } } @@ -279,7 +279,7 @@ public function testVerifyRequiredArgument() } catch (Zend_Exception $e) { $this->assertTrue( $e instanceof Zend_Console_Getopt_Exception, - 'Expected Zend_Console_Getopt_Exception, got ' . get_class($e) + 'Expected Zend_Console_Getopt_Exception, got ' . $e::class ); $this->assertEquals( 'Option "$alias" requires a parameter.', $e->getMessage() @@ -322,7 +322,7 @@ public function testEmptyRequiredOption() } catch (Zend_Exception $e) { $this->assertTrue( $e instanceof Zend_Console_Getopt_Exception, - 'Expected Zend_Console_Getopt_Exception, got ' . get_class($e) + 'Expected Zend_Console_Getopt_Exception, got ' . $e::class ); $this->assertEquals( 'Option "a" requires a parameter.', $e->getMessage() @@ -342,7 +342,7 @@ public function testGetoptAddSetNonArrayArguments() $this->fail('Expected to catch a Zend_Console_Getopt_Exception'); } catch (Zend_Exception $e) { $this->assertTrue($e instanceof Zend_Console_Getopt_Exception, - 'Expected Zend_Console_Getopt_Exception, got ' . get_class($e)); + 'Expected Zend_Console_Getopt_Exception, got ' . $e::class); $this->assertEquals('Parameter #1 to setArguments should be an array', $e->getMessage()); } @@ -352,7 +352,7 @@ public function testGetoptAddSetNonArrayArguments() $this->fail('Expected to catch a Zend_Console_Getopt_Exception'); } catch (Zend_Exception $e) { $this->assertTrue($e instanceof Zend_Console_Getopt_Exception, - 'Expected Zend_Console_Getopt_Exception, got ' . get_class($e)); + 'Expected Zend_Console_Getopt_Exception, got ' . $e::class); $this->assertEquals('Parameter #1 to addArguments should be an array', $e->getMessage()); } @@ -383,7 +383,7 @@ public function testGetoptDashDashFalse() $this->fail('Expected to catch Zend_Console_Getopt_Exception'); } catch (Zend_Exception $e) { $this->assertTrue($e instanceof Zend_Console_Getopt_Exception, - 'Expected Zend_Console_Getopt_Exception, got ' . get_class($e)); + 'Expected Zend_Console_Getopt_Exception, got ' . $e::class); $this->assertEquals($e->getMessage(), 'Option "fakeflag" is not recognized.'); } } @@ -417,7 +417,7 @@ public function testGetoptUsageMessageFromException() $this->fail('Expected to catch Zend_Console_Getopt_Exception'); } catch (Zend_Exception $e) { $this->assertTrue($e instanceof Zend_Console_Getopt_Exception, - 'Expected Zend_Console_Getopt_Exception, got ' . get_class($e)); + 'Expected Zend_Console_Getopt_Exception, got ' . $e::class); $message = preg_replace('/Usage: .* \[ options \]/', 'Usage: [ options ]', $e->getUsageMessage()); @@ -452,7 +452,7 @@ public function testGetoptSetAliasesWithNamingConflict() $this->fail('Expected to catch Zend_Console_Getopt_Exception'); } catch (Zend_Exception $e) { $this->assertTrue($e instanceof Zend_Console_Getopt_Exception, - 'Expected Zend_Console_Getopt_Exception, got ' . get_class($e)); + 'Expected Zend_Console_Getopt_Exception, got ' . $e::class); $this->assertEquals($e->getMessage(), 'Option "--apple" is being defined more than once.'); } } @@ -468,7 +468,7 @@ public function testGetoptSetAliasesInvalid() $this->fail('Expected to catch Zend_Console_Getopt_Exception'); } catch (Zend_Exception $e) { $this->assertTrue($e instanceof Zend_Console_Getopt_Exception, - 'Expected Zend_Console_Getopt_Exception, got ' . get_class($e)); + 'Expected Zend_Console_Getopt_Exception, got ' . $e::class); $this->assertEquals('Option "c" is not recognized.', $e->getMessage()); } } @@ -525,7 +525,7 @@ public function testGetoptCheckParameterType() $this->fail('Expected to catch Zend_Console_Getopt_Exception'); } catch (Zend_Exception $e) { $this->assertTrue($e instanceof Zend_Console_Getopt_Exception, - 'Expected Zend_Console_Getopt_Exception, got ' . get_class($e)); + 'Expected Zend_Console_Getopt_Exception, got ' . $e::class); $this->assertEquals($e->getMessage(), 'Option "apple" requires an integer parameter, but was given "noninteger".'); } @@ -539,7 +539,7 @@ public function testGetoptCheckParameterType() $this->fail('Expected to catch Zend_Console_Getopt_Exception'); } catch (Zend_Exception $e) { $this->assertTrue($e instanceof Zend_Console_Getopt_Exception, - 'Expected Zend_Console_Getopt_Exception, got ' . get_class($e)); + 'Expected Zend_Console_Getopt_Exception, got ' . $e::class); $this->assertEquals($e->getMessage(), 'Option "banana" requires a single-word parameter, but was given "two words".'); } @@ -571,7 +571,7 @@ public function testRegisterArgcArgvOffThrowsException() $opts = new Zend_Console_GetOpt('abp:'); $this->fail(); } catch (Zend_Console_GetOpt_Exception $e) { - $this->assertContains('$_SERVER["argv"]', $e->getMessage()); + $this->assertStringContainsString('$_SERVER["argv"]', $e->getMessage()); } $_SERVER['argv'] = $argv; diff --git a/tests/Zend/Controller/Action/Helper/ActionStackTest.php b/tests/Zend/Controller/Action/Helper/ActionStackTest.php index 1d641d61..c36dae3d 100644 --- a/tests/Zend/Controller/Action/Helper/ActionStackTest.php +++ b/tests/Zend/Controller/Action/Helper/ActionStackTest.php @@ -48,7 +48,7 @@ class Zend_Controller_Action_Helper_ActionStackTest extends \PHPUnit\Framework\T public static function main() { $suite = new \PHPUnit\Framework\TestSuite('Zend_Controller_Action_Helper_ActionStackTest'); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } /** @@ -155,7 +155,7 @@ public function testDirectProxiesToActionToStack() } catch (Zend_Exception $e) { $this->assertTrue( $e instanceof Zend_Controller_Action_Exception, - 'Zend_Controller_Action_Exception expected, ' . get_class($e) + 'Zend_Controller_Action_Exception expected, ' . $e::class . ' caught' ); } diff --git a/tests/Zend/Controller/Action/Helper/AjaxContextTest.php b/tests/Zend/Controller/Action/Helper/AjaxContextTest.php index 27f77f2f..b8744a0e 100644 --- a/tests/Zend/Controller/Action/Helper/AjaxContextTest.php +++ b/tests/Zend/Controller/Action/Helper/AjaxContextTest.php @@ -45,7 +45,7 @@ class Zend_Controller_Action_Helper_AjaxContextTest extends \PHPUnit\Framework\T public static function main() { $suite = new \PHPUnit\Framework\TestSuite('Zend_Controller_Action_Helper_AjaxContextTest'); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } /** diff --git a/tests/Zend/Controller/Action/Helper/CacheTest.php b/tests/Zend/Controller/Action/Helper/CacheTest.php index e7a0c91a..8923533e 100644 --- a/tests/Zend/Controller/Action/Helper/CacheTest.php +++ b/tests/Zend/Controller/Action/Helper/CacheTest.php @@ -22,7 +22,7 @@ class Zend_Controller_Action_Helper_CacheTest extends \PHPUnit\Framework\TestCas public static function main() { $suite = new \PHPUnit\Framework\TestSuite('Zend_Controller_Action_Helper_CacheTest'); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } public function setUp(): void diff --git a/tests/Zend/Controller/Action/Helper/ContextSwitchTest.php b/tests/Zend/Controller/Action/Helper/ContextSwitchTest.php index 46261f11..acda2cd9 100644 --- a/tests/Zend/Controller/Action/Helper/ContextSwitchTest.php +++ b/tests/Zend/Controller/Action/Helper/ContextSwitchTest.php @@ -47,7 +47,7 @@ class Zend_Controller_Action_Helper_ContextSwitchTest extends \PHPUnit\Framework public static function main() { $suite = new \PHPUnit\Framework\TestSuite('Zend_Controller_Action_Helper_ContextSwitchTest'); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } /** @@ -105,21 +105,21 @@ public function testDirectReturnsObjectInstance() public function testSetSuffixModifiesContextSuffix() { $this->helper->setSuffix('xml', 'foobar'); - $this->assertContains('foobar', $this->helper->getSuffix('xml')); + $this->assertStringContainsString('foobar', $this->helper->getSuffix('xml')); } public function testSetSuffixPrependsToViewRendererSuffixByDefault() { $this->helper->setSuffix('xml', 'foobar'); $expected = 'foobar.' . $this->viewRenderer->getViewSuffix(); - $this->assertContains($expected, $this->helper->getSuffix('xml')); + $this->assertStringContainsString($expected, $this->helper->getSuffix('xml')); } public function testCanSetSuffixWithoutViewRendererSuffix() { $this->helper->setSuffix('xml', 'foobar', false); $expected = 'foobar'; - $this->assertContains($expected, $this->helper->getSuffix('xml')); + $this->assertStringContainsString($expected, $this->helper->getSuffix('xml')); } public function testSuffixAccessorsThrowExceptionOnInvalidContextType() @@ -128,14 +128,14 @@ public function testSuffixAccessorsThrowExceptionOnInvalidContextType() $this->helper->setSuffix('foobar', 'foobar'); $this->fail('setSuffix() should throw exception with invalid context type'); } catch (Zend_Controller_Action_Exception $e) { - $this->assertContains('Cannot set suffix', $e->getMessage()); + $this->assertStringContainsString('Cannot set suffix', $e->getMessage()); } try { $this->helper->getSuffix('foobar'); $this->fail('getSuffix() should throw exception with invalid context type'); } catch (Zend_Controller_Action_Exception $e) { - $this->assertContains('Cannot retrieve suffix', $e->getMessage()); + $this->assertStringContainsString('Cannot retrieve suffix', $e->getMessage()); } } @@ -170,7 +170,7 @@ public function testAddHeaderThrowsExceptionWhenReferencingExistingHeader() $this->helper->addHeader('xml', 'Content-Type', 'application/xml'); $this->fail('addHeader() should raise exception for existing headers'); } catch (Zend_Controller_Exception $e) { - $this->assertContains('already exists', $e->getMessage()); + $this->assertStringContainsString('already exists', $e->getMessage()); } } @@ -213,56 +213,56 @@ public function testHeaderAccessorsThrowExceptionOnInvalidContextType() $this->helper->addHeader('foobar', 'foobar', 'baz'); $this->fail('addHeader() should throw exception with invalid context type'); } catch (Zend_Controller_Action_Exception $e) { - $this->assertContains('does not exist', $e->getMessage()); + $this->assertStringContainsString('does not exist', $e->getMessage()); } try { $this->helper->setHeader('foobar', 'foobar', 'baz'); $this->fail('setHeader() should throw exception with invalid context type'); } catch (Zend_Controller_Action_Exception $e) { - $this->assertContains('does not exist', $e->getMessage()); + $this->assertStringContainsString('does not exist', $e->getMessage()); } try { $this->helper->getHeader('foobar', 'Content-Type'); $this->fail('getHeader() should throw exception with invalid context type'); } catch (Zend_Controller_Action_Exception $e) { - $this->assertContains('does not exist', $e->getMessage()); + $this->assertStringContainsString('does not exist', $e->getMessage()); } try { $this->helper->getHeaders('foobar'); $this->fail('getHeaders() should throw exception with invalid context type'); } catch (Zend_Controller_Action_Exception $e) { - $this->assertContains('does not exist', $e->getMessage()); + $this->assertStringContainsString('does not exist', $e->getMessage()); } try { $this->helper->addHeaders('foobar', array('X-Foo' => 'Bar')); $this->fail('addHeaders() should throw exception with invalid context type'); } catch (Zend_Controller_Action_Exception $e) { - $this->assertContains('does not exist', $e->getMessage()); + $this->assertStringContainsString('does not exist', $e->getMessage()); } try { $this->helper->setHeaders('foobar', array('X-Foo' => 'Bar')); $this->fail('setHeaders() should throw exception with invalid context type'); } catch (Zend_Controller_Action_Exception $e) { - $this->assertContains('does not exist', $e->getMessage()); + $this->assertStringContainsString('does not exist', $e->getMessage()); } try { $this->helper->removeHeader('foobar', 'X-Foo'); $this->fail('removeHeader() should throw exception with invalid context type'); } catch (Zend_Controller_Action_Exception $e) { - $this->assertContains('does not exist', $e->getMessage()); + $this->assertStringContainsString('does not exist', $e->getMessage()); } try { $this->helper->clearHeaders('foobar'); $this->fail('clearHeaders() should throw exception with invalid context type'); } catch (Zend_Controller_Action_Exception $e) { - $this->assertContains('does not exist', $e->getMessage()); + $this->assertStringContainsString('does not exist', $e->getMessage()); } } @@ -324,7 +324,7 @@ public function testAddContextThrowsExceptionIfContextAlreadyExists() $this->helper->addContext('xml', array()); $this->fail('Shold not be able to add context if already exists'); } catch (Zend_Controller_Exception $e) { - $this->assertContains('exists', $e->getMessage()); + $this->assertStringContainsString('exists', $e->getMessage()); } } @@ -374,9 +374,9 @@ public function testCanOverwriteManyContextsAtOnce() $this->assertTrue($this->helper->hasContext('barbaz')); $this->assertEquals('xml', $this->helper->getSuffix('xml')); $this->assertNotEquals('foo.bar', $this->helper->getSuffix('foobar')); - $this->assertContains('foo.bar', $this->helper->getSuffix('foobar')); + $this->assertStringContainsString('foo.bar', $this->helper->getSuffix('foobar')); $this->assertNotEquals('bar.baz', $this->helper->getSuffix('barbaz')); - $this->assertContains('bar.baz', $this->helper->getSuffix('barbaz')); + $this->assertStringContainsString('bar.baz', $this->helper->getSuffix('barbaz')); } public function testCanRemoveSingleContext() @@ -425,7 +425,7 @@ public function testSetDefaultContextThrowsExceptionIfContextDoesNotExist() $this->helper->setDefaultContext('foobar'); $this->fail('setDefaultContext() should raise exception if context does not exist'); } catch (Zend_Controller_Action_Exception $e) { - $this->assertContains('Cannot set default context', $e->getMessage()); + $this->assertStringContainsString('Cannot set default context', $e->getMessage()); } } @@ -829,7 +829,7 @@ public function testPostJsonContextDoesntThrowExceptionWhenGetVarsMethodsExists( try { $this->helper->setAutoJsonSerialization(true); $this->helper->postJsonContext(); - } catch (Zend_Controller_Action_Exception $zcae) { + } catch (Zend_Controller_Action_Exception) { $this->fail('Exception should be throw when view does not implement getVars() method'); } self::assertTrue(true); @@ -847,7 +847,7 @@ public function testPostJsonContextThrowsExceptionWhenGetVarsMethodsDoesntExist( $this->helper->setAutoJsonSerialization(true); $this->helper->postJsonContext(); $this->fail('Exception should be throw when view does not implement getVars() method'); - } catch (Zend_Controller_Action_Exception $zcae) { + } catch (Zend_Controller_Action_Exception) { self::assertTrue(true); } } diff --git a/tests/Zend/Controller/Action/Helper/FlashMessengerTest.php b/tests/Zend/Controller/Action/Helper/FlashMessengerTest.php index e54cd154..45d23002 100644 --- a/tests/Zend/Controller/Action/Helper/FlashMessengerTest.php +++ b/tests/Zend/Controller/Action/Helper/FlashMessengerTest.php @@ -66,14 +66,14 @@ class Zend_Controller_Action_Helper_FlashMessengerTest extends \PHPUnit\Framewor public static function main() { $suite = new \PHPUnit\Framework\TestSuite('Zend_Controller_Action_Helper_FlashMessengerTest'); - $result = \PHPUnit\TextUI\TestRunner::run($suite); + $result = (new \PHPUnit\TextUI\TestRunner())->run($suite); } public function setUp(): void { $savePath = ini_get('session.save_path'); if (strpos($savePath, ';')) { - $savePath = explode(';', $savePath); + $savePath = explode(';', (string) $savePath); $savePath = array_pop($savePath); } if (empty($savePath)) { @@ -96,32 +96,32 @@ public function setUp(): void $this->helper = new Zend_Controller_Action_Helper_FlashMessenger(); } - public function testLoadFlashMessenger() + public function testLoadFlashMessenger(): never { $this->markTestSkipped(); $response = $this->front->dispatch($this->request); - $this->assertEquals('Zend_Controller_Action_Helper_FlashMessenger123456', $response->getBody()); + static::assertEquals('Zend_Controller_Action_Helper_FlashMessenger123456', $response->getBody()); } - public function testClearMessages() + public function testClearMessages(): never { $this->markTestSkipped(); $this->helper->addMessage('foo'); $this->helper->addMessage('bar'); - $this->assertTrue($this->helper->hasMessages()); - $this->assertEquals(2, count($this->helper)); + static::assertTrue($this->helper->hasMessages()); + static::assertEquals(2, count($this->helper)); $this->helper->clearMessages(); - $this->assertFalse($this->helper->hasMessages()); - $this->assertEquals(0, count($this->helper)); + static::assertFalse($this->helper->hasMessages()); + static::assertEquals(0, count($this->helper)); } - public function testDirectProxiesToAddMessage() + public function testDirectProxiesToAddMessage(): never { $this->markTestSkipped(); $this->helper->direct('foo'); - $this->assertTrue($this->helper->hasMessages()); - $this->assertEquals(1, count($this->helper)); + static::assertTrue($this->helper->hasMessages()); + static::assertEquals(1, count($this->helper)); } /** diff --git a/tests/Zend/Controller/Action/Helper/RedirectorTest.php b/tests/Zend/Controller/Action/Helper/RedirectorTest.php index 2021e203..97c4c3c8 100644 --- a/tests/Zend/Controller/Action/Helper/RedirectorTest.php +++ b/tests/Zend/Controller/Action/Helper/RedirectorTest.php @@ -483,7 +483,7 @@ public function testServerVariableHttpsToOffDoesNotBuildHttpsUrl() $this->redirector->gotoUrl('/bar/baz'); $test = $this->redirector->getRedirectUrl(); - $this->assertNotContains('https://', $test); + $this->assertStringNotContainsString('https://', $test); $this->assertEquals('http://localhost/bar/baz', $test); } diff --git a/tests/Zend/Controller/Action/Helper/UrlTest.php b/tests/Zend/Controller/Action/Helper/UrlTest.php index a717deee..f703be1e 100644 --- a/tests/Zend/Controller/Action/Helper/UrlTest.php +++ b/tests/Zend/Controller/Action/Helper/UrlTest.php @@ -65,8 +65,8 @@ public function testSimpleWithAllParamsProducesAppropriateUrl() { $url = $this->helper->simple('baz', 'bar', 'foo', array('bat' => 'foo', 'ho' => 'hum')); $this->assertEquals('/foo/bar/baz', substr($url, 0, 12)); - $this->assertContains('/bat/foo', $url); - $this->assertContains('/ho/hum', $url); + $this->assertStringContainsString('/bat/foo', $url); + $this->assertStringContainsString('/ho/hum', $url); } public function testSimpleWithMissingControllerAndModuleProducesAppropriateUrl() @@ -76,8 +76,8 @@ public function testSimpleWithMissingControllerAndModuleProducesAppropriateUrl() ->setControllerName('bar'); $url = $this->helper->simple('baz', null, null, array('bat' => 'foo', 'ho' => 'hum')); $this->assertEquals('/foo/bar/baz', substr($url, 0, 12)); - $this->assertContains('/bat/foo', $url); - $this->assertContains('/ho/hum', $url); + $this->assertStringContainsString('/bat/foo', $url); + $this->assertStringContainsString('/ho/hum', $url); } public function testSimpleWithDefaultModuleProducesUrlWithoutModuleSegment() @@ -132,16 +132,16 @@ public function testUrlMethodCreatesUrlBasedOnPassedParametersUsingDefaultRouteW 'ho' => 'hum', )); $this->assertEquals('/foo/bar/baz', substr($url, 0, 12)); - $this->assertContains('/bat/foo', $url); - $this->assertContains('/ho/hum', $url); + $this->assertStringContainsString('/bat/foo', $url); + $this->assertStringContainsString('/ho/hum', $url); } public function testDirectProxiesToSimple() { $url = $this->helper->direct('baz', 'bar', 'foo', array('bat' => 'foo', 'ho' => 'hum')); $this->assertEquals('/foo/bar/baz', substr($url, 0, 12)); - $this->assertContains('/bat/foo', $url); - $this->assertContains('/ho/hum', $url); + $this->assertStringContainsString('/bat/foo', $url); + $this->assertStringContainsString('/ho/hum', $url); } /** diff --git a/tests/Zend/Controller/Action/Helper/ViewRendererTest.php b/tests/Zend/Controller/Action/Helper/ViewRendererTest.php index 4d24c138..d27bee4c 100644 --- a/tests/Zend/Controller/Action/Helper/ViewRendererTest.php +++ b/tests/Zend/Controller/Action/Helper/ViewRendererTest.php @@ -310,7 +310,7 @@ public function testNeverRenderFlagDisablesRendering() $this->helper->postDispatch(); $content = $this->response->getBody(); - $this->assertNotContains('Rendered index/test.phtml', $this->response->getBody()); + $this->assertStringNotContainsString('Rendered index/test.phtml', $this->response->getBody()); } public function testNoRenderFlag() @@ -388,7 +388,7 @@ public function testPostDispatchRendersAppropriateScript() $this->helper->postDispatch(); $content = $this->response->getBody(); - $this->assertContains('Rendered index/test.phtml in bar module', $content); + $this->assertStringContainsString('Rendered index/test.phtml in bar module', $content); } public function testPostDispatchDoesNothingOnForward() @@ -402,7 +402,7 @@ public function testPostDispatchDoesNothingOnForward() $this->helper->postDispatch(); $content = $this->response->getBody(); - $this->assertNotContains('Rendered index/test.phtml in bar module', $content); + $this->assertStringNotContainsString('Rendered index/test.phtml in bar module', $content); $this->assertTrue(empty($content)); } @@ -418,7 +418,7 @@ public function testPostDispatchDoesNothingOnRedirect() $this->helper->postDispatch(); $content = $this->response->getBody(); - $this->assertNotContains('Rendered index/test.phtml in bar module', $content); + $this->assertStringNotContainsString('Rendered index/test.phtml in bar module', $content); $this->assertTrue(empty($content)); } @@ -431,7 +431,7 @@ public function testPostDispatchDoesNothingWithNoController() $this->helper->postDispatch(); $content = $this->response->getBody(); - $this->assertNotContains('Rendered index/test.phtml in bar module', $content); + $this->assertStringNotContainsString('Rendered index/test.phtml in bar module', $content); $this->assertTrue(empty($content)); } @@ -445,7 +445,7 @@ public function testPostDispatchDoesNothingWithNeverController() $this->helper->postDispatch(); $content = $this->response->getBody(); - $this->assertNotContains('Rendered index/test.phtml in bar module', $content); + $this->assertStringNotContainsString('Rendered index/test.phtml in bar module', $content); $this->assertTrue(empty($content)); } @@ -543,7 +543,7 @@ public function testRenderScript() $controller = new Bar_IndexController($this->request, $this->response, array()); $this->helper->renderScript('index/test.phtml'); $body = $this->response->getBody(); - $this->assertContains('Rendered index/test.phtml in bar module', $body); + $this->assertStringContainsString('Rendered index/test.phtml in bar module', $body); } public function testRenderScriptToNamedResponseSegment() @@ -554,7 +554,7 @@ public function testRenderScriptToNamedResponseSegment() $controller = new Bar_IndexController($this->request, $this->response, array()); $this->helper->renderScript('index/test.phtml', 'foo'); $body = $this->response->getBody('foo'); - $this->assertContains('Rendered index/test.phtml in bar module', $body); + $this->assertStringContainsString('Rendered index/test.phtml in bar module', $body); } public function testRenderScriptToPreviouslyNamedResponseSegment() @@ -566,7 +566,7 @@ public function testRenderScriptToPreviouslyNamedResponseSegment() $this->helper->setResponseSegment('foo'); $this->helper->renderScript('index/test.phtml'); $body = $this->response->getBody('foo'); - $this->assertContains('Rendered index/test.phtml in bar module', $body); + $this->assertStringContainsString('Rendered index/test.phtml in bar module', $body); } public function testRenderWithDefaults() @@ -577,7 +577,7 @@ public function testRenderWithDefaults() $controller = new Bar_IndexController($this->request, $this->response, array()); $this->helper->render(); $body = $this->response->getBody(); - $this->assertContains('Rendered index/test.phtml in bar module', $body); + $this->assertStringContainsString('Rendered index/test.phtml in bar module', $body); } public function testRenderToSpecifiedAction() @@ -588,7 +588,7 @@ public function testRenderToSpecifiedAction() $controller = new Bar_IndexController($this->request, $this->response, array()); $this->helper->render('test'); $body = $this->response->getBody(); - $this->assertContains('Rendered index/test.phtml in bar module', $body); + $this->assertStringContainsString('Rendered index/test.phtml in bar module', $body); } public function testRenderWithNoController() @@ -599,7 +599,7 @@ public function testRenderWithNoController() $controller = new Bar_IndexController($this->request, $this->response, array()); $this->helper->render(null, null, true); $body = $this->response->getBody(); - $this->assertContains('Rendered test.phtml in bar module', $body); + $this->assertStringContainsString('Rendered test.phtml in bar module', $body); } public function testRenderToNamedSegment() @@ -610,7 +610,7 @@ public function testRenderToNamedSegment() $controller = new Bar_IndexController($this->request, $this->response, array()); $this->helper->render(null, 'foo'); $body = $this->response->getBody('foo'); - $this->assertContains('Rendered index/test.phtml in bar module', $body); + $this->assertStringContainsString('Rendered index/test.phtml in bar module', $body); } public function testRenderBySpec() @@ -621,7 +621,7 @@ public function testRenderBySpec() $controller = new Bar_IndexController($this->request, $this->response, array()); $this->helper->renderBySpec('foo', array('controller' => 'test', 'suffix' => 'php')); $body = $this->response->getBody(); - $this->assertContains('Rendered test/foo.php', $body); + $this->assertStringContainsString('Rendered test/foo.php', $body); } public function testRenderBySpecToNamedResponseSegment() @@ -632,7 +632,7 @@ public function testRenderBySpecToNamedResponseSegment() $controller = new Bar_IndexController($this->request, $this->response, array()); $this->helper->renderBySpec('foo', array('controller' => 'test', 'suffix' => 'php'), 'foo'); $body = $this->response->getBody('foo'); - $this->assertContains('Rendered test/foo.php', $body); + $this->assertStringContainsString('Rendered test/foo.php', $body); } public function testInitDoesNotInitViewWhenNoViewRendererSet() @@ -718,7 +718,7 @@ public function testCustomInflectorCanUseItsOwnTarget() $this->helper->render(); $body = $this->response->getBody(); - $this->assertContains('Rendered test.phtml in bar module', $body); + $this->assertStringContainsString('Rendered test.phtml in bar module', $body); } public function testCustomInflectorUsesViewRendererTargetWhenPassedInWithReferenceFlag() @@ -747,7 +747,7 @@ public function testCustomInflectorUsesViewRendererTargetWhenPassedInWithReferen $this->helper->render(); $body = $this->response->getBody(); - $this->assertContains('Rendered index/test.phtml in bar module', $body); + $this->assertStringContainsString('Rendered index/test.phtml in bar module', $body); } public function testStockInflectorAllowsSubDirectoryViewScripts() @@ -812,7 +812,7 @@ public function testCorrectViewHelperPathShouldBePropagatedWhenSubControllerInvo $this->helper->render(); $body = $this->response->getBody(); - $this->assertContains('fooUseHelper invoked', $body, 'Received ' . $body); + $this->assertStringContainsString('fooUseHelper invoked', $body, 'Received ' . $body); } /** @@ -838,7 +838,7 @@ public function testCorrectViewHelperPathShouldBePropagatedWhenSubControllerInvo $this->helper->render(); $body = $this->response->getBody(); - $this->assertContains('SampleZfHelper invoked', $body, 'Received ' . $body); + $this->assertStringContainsString('SampleZfHelper invoked', $body, 'Received ' . $body); } /** diff --git a/tests/Zend/Controller/Action/HelperBrokerTest.php b/tests/Zend/Controller/Action/HelperBrokerTest.php index 689a342f..17962c5b 100644 --- a/tests/Zend/Controller/Action/HelperBrokerTest.php +++ b/tests/Zend/Controller/Action/HelperBrokerTest.php @@ -173,7 +173,7 @@ public function testNonExistentHelper() $this->front->returnResponse(true); $response = $this->front->dispatch($request); - $this->assertContains('not found', $response->getBody()); + $this->assertStringContainsString('not found', $response->getBody()); } public function testCustomHelperRegistered() diff --git a/tests/Zend/Controller/ActionTest.php b/tests/Zend/Controller/ActionTest.php index 9ed46f10..714f4657 100644 --- a/tests/Zend/Controller/ActionTest.php +++ b/tests/Zend/Controller/ActionTest.php @@ -184,7 +184,7 @@ public function testRun2() $response = $this->_controller->run(); $this->fail('Should not be able to call bar as action'); } catch (Exception $e) { - //success! + self::assertTrue(true); } } @@ -296,7 +296,7 @@ public function testRender() $controller = new ViewController($request, $response); $controller->indexAction(); - $this->assertContains('In the index action view', $response->getBody()); + $this->assertStringContainsString('In the index action view', $response->getBody()); } public function testRenderByName() @@ -310,7 +310,7 @@ public function testRenderByName() $controller = new ViewController($request, $response); $controller->testAction(); - $this->assertContains('In the index action view', $response->getBody()); + $this->assertStringContainsString('In the index action view', $response->getBody()); } public function testRenderOutsideControllerSubdir() @@ -324,7 +324,7 @@ public function testRenderOutsideControllerSubdir() $controller = new ViewController($request, $response); $controller->siteAction(); - $this->assertContains('In the sitewide view', $response->getBody()); + $this->assertStringContainsString('In the sitewide view', $response->getBody()); } public function testRenderNamedSegment() @@ -338,7 +338,7 @@ public function testRenderNamedSegment() $controller = new ViewController($request, $response); $controller->nameAction(); - $this->assertContains('In the name view', $response->getBody('name')); + $this->assertStringContainsString('In the name view', $response->getBody('name')); } public function testRenderNormalizesScriptName() @@ -352,7 +352,7 @@ public function testRenderNormalizesScriptName() $controller = new FooBarController($request, $response); $controller->bazBatAction(); - $this->assertContains('Inside foo-bar/baz-bat.phtml', $response->getBody()); + $this->assertStringContainsString('Inside foo-bar/baz-bat.phtml', $response->getBody()); } public function testGetViewScript() @@ -366,10 +366,10 @@ public function testGetViewScript() $controller = new ViewController($request, $response); $script = $controller->getViewScript(); - $this->assertContains('view' . DIRECTORY_SEPARATOR . 'test.phtml', $script); + $this->assertStringContainsString('view' . DIRECTORY_SEPARATOR . 'test.phtml', $script); $script = $controller->getViewScript('foo'); - $this->assertContains('view' . DIRECTORY_SEPARATOR . 'foo.phtml', $script); + $this->assertStringContainsString('view' . DIRECTORY_SEPARATOR . 'foo.phtml', $script); } public function testGetViewScriptDoesNotOverwriteNoControllerFlagWhenNullPassed() @@ -405,7 +405,7 @@ public function testRenderScript() $controller = new ViewController($request, $response); $controller->scriptAction(); - $this->assertContains('Inside custom/renderScript.php', $response->getBody()); + $this->assertStringContainsString('Inside custom/renderScript.php', $response->getBody()); } public function testRenderScriptToNamedResponseSegment() @@ -420,7 +420,7 @@ public function testRenderScriptToNamedResponseSegment() $controller->scriptNameAction(); - $this->assertContains('Inside custom/renderScript.php', $response->getBody('foo')); + $this->assertStringContainsString('Inside custom/renderScript.php', $response->getBody('foo')); } public function testGetHelper() @@ -463,7 +463,7 @@ public function testRenderUsingViewRenderer() $controller = new ViewController($request, $response); $controller->scriptAction(); - $this->assertContains('Inside custom/renderScript.php', $response->getBody()); + $this->assertStringContainsString('Inside custom/renderScript.php', $response->getBody()); } public function testMissingActionExceptionsDifferFromMissingMethods() @@ -473,8 +473,8 @@ public function testMissingActionExceptionsDifferFromMissingMethods() $this->fail('Invalid action should throw exception'); } catch (Zend_Controller_Exception $e) { $this->assertRegexp('/^Action.*?(does not exist and was not trapped in __call\(\))$/', $e->getMessage()); - $this->assertContains('bogus', $e->getMessage()); - $this->assertNotContains('bogusAction', $e->getMessage()); + $this->assertStringContainsString('bogus', $e->getMessage()); + $this->assertStringNotContainsString('bogusAction', $e->getMessage()); $this->assertEquals(404, $e->getCode()); } @@ -483,7 +483,7 @@ public function testMissingActionExceptionsDifferFromMissingMethods() $this->fail('Invalid method should throw exception'); } catch (Zend_Controller_Exception $e) { $this->assertRegexp('/^Method.*?(does not exist and was not trapped in __call\(\))$/', $e->getMessage()); - $this->assertContains('bogus', $e->getMessage()); + $this->assertStringContainsString('bogus', $e->getMessage()); $this->assertEquals(500, $e->getCode()); } } diff --git a/tests/Zend/Controller/Dispatcher/StandardTest.php b/tests/Zend/Controller/Dispatcher/StandardTest.php index 85ce133a..4bc23d4e 100644 --- a/tests/Zend/Controller/Dispatcher/StandardTest.php +++ b/tests/Zend/Controller/Dispatcher/StandardTest.php @@ -207,7 +207,7 @@ public function testDispatchValidControllerWithInvalidAction() $this->_dispatcher->dispatch($request, $response); $this->fail('Exception should be raised by __call'); } catch (Exception $e) { - // success + self::assertTrue(true); } } @@ -221,7 +221,7 @@ public function testDispatchInvalidController() $this->_dispatcher->dispatch($request, $response); $this->fail('Exception should be raised; no such controller'); } catch (Exception $e) { - // success + self::assertTrue(true); } } @@ -563,7 +563,7 @@ public function testDispatcherCanDispatchControllersFromModuleWithHyphenatedName $response = new Zend_Controller_Response_Cli(); $dispatcher->dispatch($request, $response); $body = $dispatcher->getResponse()->getBody(); - $this->assertContains('BazBat_FooController::indexAction() called', $body, $body); + $this->assertStringContainsString('BazBat_FooController::indexAction() called', $body, $body); } public function testLoadClassLoadsControllerInDefaultModuleWithModulePrefixWhenRequested() @@ -614,7 +614,7 @@ public function testCamelCasedActionsNotRequestedWithWordSeparatorsShouldNotReso $this->_dispatcher->dispatch($request, $response); $this->fail('Invalid camelCased action should raise exception'); } catch (Zend_Controller_Exception $e) { - $this->assertContains('does not exist', $e->getMessage()); + $this->assertStringContainsString('does not exist', $e->getMessage()); } } @@ -689,7 +689,7 @@ public function testGetControllerClassThrowsExceptionIfNoDefaultModuleDefined() try { $class = $this->_dispatcher->getControllerClass($request); } catch (Zend_Controller_Exception $e) { - $this->assertContains('No default module', $e->getMessage()); + $this->assertStringContainsString('No default module', $e->getMessage()); } } } diff --git a/tests/Zend/Controller/FrontTest.php b/tests/Zend/Controller/FrontTest.php index 2bf49198..c4b3b959 100644 --- a/tests/Zend/Controller/FrontTest.php +++ b/tests/Zend/Controller/FrontTest.php @@ -108,7 +108,7 @@ public function testSetRequestThrowsExceptionWithBadRequest() $this->_controller->setRequest(\Zend_Controller_Response_Cli::class); $this->fail('Should not be able to set invalid request class'); } catch (Exception $e) { - // success + self::assertTrue(true); } } @@ -130,7 +130,7 @@ public function testSetResponseThrowsExceptionWithBadResponse() $this->_controller->setResponse(\Zend_Controller_Request_Http::class); $this->fail('Should not be able to set invalid response class'); } catch (Exception $e) { - // success + self::assertTrue(true); } } @@ -152,7 +152,7 @@ public function testSetRouterThrowsExceptionWithBadRouter() $this->_controller->setRouter(\Zend_Controller_Request_Http::class); $this->fail('Should not be able to set invalid router class'); } catch (Exception $e) { - // success + self::assertTrue(true); } } @@ -401,7 +401,7 @@ public function testSetBaseUrlThrowsExceptionOnNonString() $this->_controller->setBaseUrl(array()); $this->fail('Should not be able to set non-string base URL'); } catch (Exception $e) { - // success + self::assertTrue(true); } } @@ -416,7 +416,7 @@ public function testBaseUrlPushedToRequest() $response = new Zend_Controller_Response_Cli(); $response = $this->_controller->dispatch($request, $response); - $this->assertContains('index.php', $request->getBaseUrl()); + $this->assertStringContainsString('index.php', $request->getBaseUrl()); } /** @@ -451,7 +451,7 @@ public function testThrowExceptionsThrows() $response = $this->_controller->dispatch($request); $this->fail('Invalid controller should throw exception'); } catch (Exception $e) { - // success + self::assertTrue(true); } } @@ -487,7 +487,7 @@ public function testReturnResponseReturnsResponse() $body = ob_get_clean(); $actual = $this->_controller->getResponse()->getBody(); - $this->assertContains($actual, $body); + $this->assertStringContainsString($actual, $body); } public function testRunStatically() @@ -495,6 +495,7 @@ public function testRunStatically() $request = new Zend_Controller_Request_Http('http://example.com/index/index'); $this->_controller->setRequest($request); Zend_Controller_Front::run(__DIR__ . DIRECTORY_SEPARATOR . '_files'); + self::assertTrue(true); } public function testRunDynamically() @@ -502,6 +503,7 @@ public function testRunDynamically() $request = new Zend_Controller_Request_Http('http://example.com/index/index'); $this->_controller->setRequest($request); $this->_controller->run(__DIR__ . DIRECTORY_SEPARATOR . '_files'); + self::assertTrue(true); } public function testModulePathDispatched() @@ -656,7 +658,7 @@ public function testReplaceRequestAndResponseMidStream() $this->assertNotSame($response, $responsePost); $this->assertContains('Reset action called', $responsePost->getBody()); - $this->assertNotContains('Reset action called', $response->getBody()); + $this->assertStringNotContainsString('Reset action called', $response->getBody()); } public function testViewRendererHelperRegisteredWhenDispatched() diff --git a/tests/Zend/Controller/Plugin/BrokerTest.php b/tests/Zend/Controller/Plugin/BrokerTest.php index 0c016054..486ef877 100644 --- a/tests/Zend/Controller/Plugin/BrokerTest.php +++ b/tests/Zend/Controller/Plugin/BrokerTest.php @@ -60,7 +60,7 @@ public function testDuplicatePlugin() $broker->registerPlugin($plugin); $this->fail('Duplicate registry of plugin object should be disallowed'); } catch (Exception $expected) { - $this->assertContains('already', $expected->getMessage()); + $this->assertStringContainsString('already', $expected->getMessage()); } } @@ -210,6 +210,7 @@ public function testRegisterPluginThrowsExceptionOnDuplicateStackIndex() $broker->registerPlugin($plugin2, 5); $this->fail('Registering plugins with same stack index should raise exception'); } catch (Exception $e) { + self::assertTrue(true); } } diff --git a/tests/Zend/Controller/Plugin/ErrorHandlerTest.php b/tests/Zend/Controller/Plugin/ErrorHandlerTest.php index f65011f5..b1cc5462 100644 --- a/tests/Zend/Controller/Plugin/ErrorHandlerTest.php +++ b/tests/Zend/Controller/Plugin/ErrorHandlerTest.php @@ -208,6 +208,7 @@ public function testPostDispatchDoesNothingWhenCalledRepeatedlyWithoutNewExcepti } catch (Exception $e) { $this->fail('Repeated calls with no new exceptions should not throw exceptions'); } + self::assertTrue(true); } public function testPostDispatchWithoutException() diff --git a/tests/Zend/Controller/Response/HttpTest.php b/tests/Zend/Controller/Response/HttpTest.php index 934ccd6b..a2630ee1 100644 --- a/tests/Zend/Controller/Response/HttpTest.php +++ b/tests/Zend/Controller/Response/HttpTest.php @@ -289,7 +289,7 @@ public function testSendResponseWithExceptions() ob_start(); $this->_response->sendResponse(); $string = ob_get_clean(); - $this->assertContains('Test exception rendering', $string); + $this->assertStringContainsString('Test exception rendering', $string); } public function testSetResponseCodeThrowsExceptionWithBadCode() diff --git a/tests/Zend/Controller/Response/HttpTestCaseTest.php b/tests/Zend/Controller/Response/HttpTestCaseTest.php index 916e0489..34da8fe5 100644 --- a/tests/Zend/Controller/Response/HttpTestCaseTest.php +++ b/tests/Zend/Controller/Response/HttpTestCaseTest.php @@ -70,7 +70,7 @@ public function testSendResponseShouldRenderHeaders() $this->response->setHeader('X-Foo-Bar', 'baz') ->setBody('Body to emit'); $test = $this->response->sendResponse(); - $this->assertContains("X-Foo-Bar: baz\n\nBody to emit", $test); + $this->assertStringContainsString("X-Foo-Bar: baz\n\nBody to emit", $test); } public function testOutputBodyShouldReturnStringInsteadOfEchoingOutput() @@ -83,7 +83,7 @@ public function testOutputBodyShouldReturnStringInsteadOfEchoingOutput() $test = ob_get_clean(); $this->assertTrue(empty($test)); $this->assertFalse(empty($content)); - $this->assertContains("Baz Content\nFoo Content\nBar Content\n", $content, $content); + $this->assertStringContainsString("Baz Content\nFoo Content\nBar Content\n", $content, $content); } public function testSendHeadersShouldReturnArrayOfHeadersInsteadOfSendingHeaders() diff --git a/tests/Zend/Controller/Router/RewriteTest.php b/tests/Zend/Controller/Router/RewriteTest.php index e8acdbfa..acd564b3 100644 --- a/tests/Zend/Controller/Router/RewriteTest.php +++ b/tests/Zend/Controller/Router/RewriteTest.php @@ -752,10 +752,10 @@ public function testCanGenerateNumericKeyUri() /** * @group ZF-11393 - * @expectedException Zend_Controller_Router_Exception */ public function testCallingAssembleWithNullArgumentShouldThrowException() { + $this->expectException(\Zend_Controller_Router_Exception::class); $this->_router->assemble(null); } } diff --git a/tests/Zend/Controller/Router/Route/HostnameTest.php b/tests/Zend/Controller/Router/Route/HostnameTest.php index 410a0281..225b3b9f 100644 --- a/tests/Zend/Controller/Router/Route/HostnameTest.php +++ b/tests/Zend/Controller/Router/Route/HostnameTest.php @@ -103,7 +103,7 @@ public function testAssembleHostWithMissingParam() $route->assemble(); $this->fail('An expected Zend_Controller_Router_Exception has not been raised'); } catch (Zend_Controller_Router_Exception $expected) { - $this->assertContains('subdomain is not specified', $expected->getMessage()); + $this->assertStringContainsString('subdomain is not specified', $expected->getMessage()); } } diff --git a/tests/Zend/Controller/Router/Route/ModuleTest.php b/tests/Zend/Controller/Router/Route/ModuleTest.php index 927855d3..7d77cd8d 100644 --- a/tests/Zend/Controller/Router/Route/ModuleTest.php +++ b/tests/Zend/Controller/Router/Route/ModuleTest.php @@ -467,6 +467,6 @@ public function testAssembleShouldUrlEncodeAllParameterNames() 'module' => 'default', ); $url = $this->route->assemble($params); - $this->assertNotContains('">', ); $html = $this->helper->formErrors($errors); - $this->assertNotContains($errors['bad'], $html); - $this->assertContains('&', $html); + $this->assertStringNotContainsString($errors['bad'], $html); + $this->assertStringContainsString('&', $html); } public function testCanDisableEscapingErrorMessages() @@ -136,8 +136,8 @@ public function testCanDisableEscapingErrorMessages() 'bar' => 'Please click here for more information', ); $html = $this->helper->formErrors($errors, array('escape' => false)); - $this->assertContains($errors['foo'], $html); - $this->assertContains($errors['bar'], $html); + $this->assertStringContainsString($errors['foo'], $html); + $this->assertStringContainsString($errors['bar'], $html); } /** diff --git a/tests/Zend/View/Helper/FormFileTest.php b/tests/Zend/View/Helper/FormFileTest.php index 30953e75..1ee99656 100644 --- a/tests/Zend/View/Helper/FormFileTest.php +++ b/tests/Zend/View/Helper/FormFileTest.php @@ -98,7 +98,7 @@ public function testRendersAsHtmlByDefault() $test = $this->helper->formFile(array( 'name' => 'foo', )); - $this->assertNotContains(' />', $test); + $this->assertStringNotContainsString(' />', $test); } public function testCanRendersAsXHtml() @@ -107,7 +107,7 @@ public function testCanRendersAsXHtml() $test = $this->helper->formFile(array( 'name' => 'foo', )); - $this->assertContains(' />', $test); + $this->assertStringContainsString(' />', $test); } /** diff --git a/tests/Zend/View/Helper/FormImageTest.php b/tests/Zend/View/Helper/FormImageTest.php index 650999d1..a4e76068 100644 --- a/tests/Zend/View/Helper/FormImageTest.php +++ b/tests/Zend/View/Helper/FormImageTest.php @@ -85,7 +85,7 @@ public function testRendersAsHtmlByDefault() $test = $this->helper->formImage(array( 'name' => 'foo', )); - $this->assertNotContains(' />', $test); + $this->assertStringNotContainsString(' />', $test); } /** @@ -97,6 +97,6 @@ public function testCanRendersAsXHtml() $test = $this->helper->formImage(array( 'name' => 'foo', )); - $this->assertContains(' />', $test); + $this->assertStringContainsString(' />', $test); } } diff --git a/tests/Zend/View/Helper/FormLabelTest.php b/tests/Zend/View/Helper/FormLabelTest.php index a401d946..8900c3d9 100644 --- a/tests/Zend/View/Helper/FormLabelTest.php +++ b/tests/Zend/View/Helper/FormLabelTest.php @@ -97,11 +97,11 @@ public function testNameAndIdForZF2154() public function testCanDisableEscapingLabelValue() { $label = $this->helper->formLabel('foo', 'Label This!', array('escape' => false)); - $this->assertContains('Label This!', $label); + $this->assertStringContainsString('Label This!', $label); $label = $this->helper->formLabel(array('name' => 'foo', 'value' => 'Label This!', 'escape' => false)); - $this->assertContains('Label This!', $label); + $this->assertStringContainsString('Label This!', $label); $label = $this->helper->formLabel(array('name' => 'foo', 'value' => 'Label This!', 'attribs' => array('escape' => false))); - $this->assertContains('Label This!', $label); + $this->assertStringContainsString('Label This!', $label); } /** @@ -110,7 +110,7 @@ public function testCanDisableEscapingLabelValue() public function testHelperShouldAllowSuppressionOfForAttribute() { $label = $this->helper->formLabel('foo', 'bar', array('disableFor' => true)); - $this->assertNotContains('for="foo"', $label); + $this->assertStringNotContainsString('for="foo"', $label); } /** @@ -119,6 +119,6 @@ public function testHelperShouldAllowSuppressionOfForAttribute() public function testShouldNotRenderDisableForAttributeIfForIsSuppressed() { $label = $this->helper->formLabel('foo', 'bar', array('disableFor' => true)); - $this->assertNotContains('disableFor=', $label, 'Output contains disableFor attribute!'); + $this->assertStringNotContainsString('disableFor=', $label, 'Output contains disableFor attribute!'); } } diff --git a/tests/Zend/View/Helper/FormPasswordTest.php b/tests/Zend/View/Helper/FormPasswordTest.php index c499be32..97d39051 100644 --- a/tests/Zend/View/Helper/FormPasswordTest.php +++ b/tests/Zend/View/Helper/FormPasswordTest.php @@ -88,20 +88,20 @@ public function testDisablingElementDoesNotRenderHiddenElements() public function testShouldRenderAsHtmlByDefault() { $test = $this->helper->formPassword('foo', 'bar'); - $this->assertNotContains(' />', $test); + $this->assertStringNotContainsString(' />', $test); } public function testShouldAllowRenderingAsXhtml() { $this->view->doctype('XHTML1_STRICT'); $test = $this->helper->formPassword('foo', 'bar'); - $this->assertContains(' />', $test); + $this->assertStringContainsString(' />', $test); } public function testShouldNotRenderValueByDefault() { $test = $this->helper->formPassword('foo', 'bar'); - $this->assertNotContains('bar', $test); + $this->assertStringNotContainsString('bar', $test); } /** @@ -110,7 +110,7 @@ public function testShouldNotRenderValueByDefault() public function testShouldRenderValueWhenRenderPasswordFlagPresentAndTrue() { $test = $this->helper->formPassword('foo', 'bar', array('renderPassword' => true)); - $this->assertContains('value="bar"', $test); + $this->assertStringContainsString('value="bar"', $test); } /** @@ -119,8 +119,8 @@ public function testShouldRenderValueWhenRenderPasswordFlagPresentAndTrue() public function testRenderPasswordAttribShouldNeverBeRendered() { $test = $this->helper->formPassword('foo', 'bar', array('renderPassword' => true)); - $this->assertNotContains('renderPassword', $test); + $this->assertStringNotContainsString('renderPassword', $test); $test = $this->helper->formPassword('foo', 'bar', array('renderPassword' => false)); - $this->assertNotContains('renderPassword', $test); + $this->assertStringNotContainsString('renderPassword', $test); } } diff --git a/tests/Zend/View/Helper/FormRadioTest.php b/tests/Zend/View/Helper/FormRadioTest.php index fb8a64bf..2d531b49 100644 --- a/tests/Zend/View/Helper/FormRadioTest.php +++ b/tests/Zend/View/Helper/FormRadioTest.php @@ -148,7 +148,7 @@ public function testCanSpecifyRadioSeparator() 'listsep' => '--FunkySep--', )); - $this->assertContains('--FunkySep--', $html); + $this->assertStringContainsString('--FunkySep--', $html); $count = substr_count($html, '--FunkySep--'); $this->assertEquals(2, $count); } @@ -232,8 +232,8 @@ public function testLabelsAreEscapedByDefault() 'options' => $options, )); - $this->assertNotContains($options['bar'], $html); - $this->assertContains('<b>Bar</b>', $html); + $this->assertStringNotContainsString($options['bar'], $html); + $this->assertStringContainsString('<b>Bar</b>', $html); } public function testXhtmlLabelsAreAllowed() @@ -247,7 +247,7 @@ public function testXhtmlLabelsAreAllowed() 'attribs' => array('escape' => false), )); - $this->assertContains($options['bar'], $html); + $this->assertStringContainsString($options['bar'], $html); } /** @@ -366,7 +366,7 @@ public function testRadioLabelDoesNotContainHardCodedStyle() 'value' => 'bar', 'options' => $options, )); - $this->assertNotContains('style="white-space: nowrap;"', $html); + $this->assertStringNotContainsString('style="white-space: nowrap;"', $html); } /** @@ -430,9 +430,9 @@ public function testRendersAsHtmlByDefault() 'options' => $options, )); - $this->assertContains('value="foo">', $html); - $this->assertContains('value="bar">', $html); - $this->assertContains('value="baz">', $html); + $this->assertStringContainsString('value="foo">', $html); + $this->assertStringContainsString('value="bar">', $html); + $this->assertStringContainsString('value="baz">', $html); } /** @@ -450,9 +450,9 @@ public function testCanRendersAsXHtml() 'name' => 'foo', 'options' => $options, )); - $this->assertContains('value="foo" />', $html); - $this->assertContains('value="bar" />', $html); - $this->assertContains('value="baz" />', $html); + $this->assertStringContainsString('value="foo" />', $html); + $this->assertStringContainsString('value="bar" />', $html); + $this->assertStringContainsString('value="baz" />', $html); } /** @@ -472,7 +472,7 @@ public function testSeparatorCanRendersAsXhtmlByDefault() 'options' => $options, )); - $this->assertContains('
', $html); + $this->assertStringContainsString('
', $html); $count = substr_count($html, '
'); $this->assertEquals(2, $count); } @@ -494,7 +494,7 @@ public function testeparatorCanRendersAsHtml() 'options' => $options, )); - $this->assertContains('
', $html); + $this->assertStringContainsString('
', $html); $count = substr_count($html, '
'); $this->assertEquals(2, $count); } diff --git a/tests/Zend/View/Helper/FormResetTest.php b/tests/Zend/View/Helper/FormResetTest.php index ee20f20a..eb69329c 100644 --- a/tests/Zend/View/Helper/FormResetTest.php +++ b/tests/Zend/View/Helper/FormResetTest.php @@ -87,13 +87,13 @@ public function testShouldAllowDisabling() public function testShouldRenderAsHtmlByDefault() { $test = $this->helper->formReset('foo', 'bar'); - $this->assertNotContains(' />', $test); + $this->assertStringNotContainsString(' />', $test); } public function testShouldAllowRenderingAsXHtml() { $this->view->doctype('XHTML1_STRICT'); $test = $this->helper->formReset('foo', 'bar'); - $this->assertContains(' />', $test); + $this->assertStringContainsString(' />', $test); } } diff --git a/tests/Zend/View/Helper/FormSelectTest.php b/tests/Zend/View/Helper/FormSelectTest.php index 6642788f..992f3c55 100644 --- a/tests/Zend/View/Helper/FormSelectTest.php +++ b/tests/Zend/View/Helper/FormSelectTest.php @@ -87,15 +87,15 @@ public function testFormSelectWithNameOnlyCreatesEmptySelect() { $html = $this->helper->formSelect('foo'); $this->assertRegExp('#]+name="foo"#', $html); - $this->assertContains('', $html); - $this->assertNotContains('assertStringContainsString('', $html); + $this->assertStringNotContainsString('helper->formSelect('foo', null, null, array('foo' => 'Foobar', 'baz' => 'Bazbat')); $this->assertRegExp('#]+name="foo"#', $html); - $this->assertContains('', $html); + $this->assertStringContainsString('', $html); $this->assertRegExp('#]+value="foo".*?>Foobar#', $html); $this->assertRegExp('#]+value="baz".*?>Bazbat#', $html); $this->assertEquals(2, substr_count($html, 'helper->formSubmit('foo', 'bar'); - $this->assertNotContains(' />', $test); + $this->assertStringNotContainsString(' />', $test); } public function testCanRendersAsXHtml() { $this->view->doctype('XHTML1_STRICT'); $test = $this->helper->formSubmit('foo', 'bar'); - $this->assertContains(' />', $test); + $this->assertStringContainsString(' />', $test); } /** @@ -115,6 +115,6 @@ public function testCanRendersAsXHtml() public function testDoesNotOutputEmptyId() { $test = $this->helper->formSubmit('', 'bar'); - $this->assertNotContains('id=""', $test); + $this->assertStringNotContainsString('id=""', $test); } } diff --git a/tests/Zend/View/Helper/FormTextTest.php b/tests/Zend/View/Helper/FormTextTest.php index e91b5fb6..f512449f 100644 --- a/tests/Zend/View/Helper/FormTextTest.php +++ b/tests/Zend/View/Helper/FormTextTest.php @@ -60,28 +60,28 @@ protected function setUp(): void public function testIdSetFromName() { $element = $this->helper->formText('foo'); - $this->assertContains('name="foo"', $element); - $this->assertContains('id="foo"', $element); + $this->assertStringContainsString('name="foo"', $element); + $this->assertStringContainsString('id="foo"', $element); } public function testSetIdFromAttribs() { $element = $this->helper->formText('foo', null, array('id' => 'bar')); - $this->assertContains('name="foo"', $element); - $this->assertContains('id="bar"', $element); + $this->assertStringContainsString('name="foo"', $element); + $this->assertStringContainsString('id="bar"', $element); } public function testSetValue() { $element = $this->helper->formText('foo', 'bar'); - $this->assertContains('name="foo"', $element); - $this->assertContains('value="bar"', $element); + $this->assertStringContainsString('name="foo"', $element); + $this->assertStringContainsString('value="bar"', $element); } public function testReadOnlyAttribute() { $element = $this->helper->formText('foo', null, array('readonly' => 'readonly')); - $this->assertContains('readonly="readonly"', $element); + $this->assertStringContainsString('readonly="readonly"', $element); } /** @@ -115,13 +115,13 @@ public function testDisablingElementDoesNotRenderHiddenElements() public function testRendersAsHtmlByDefault() { $test = $this->helper->formText('foo', 'bar'); - $this->assertNotContains(' />', $test); + $this->assertStringNotContainsString(' />', $test); } public function testCanRendersAsXHtml() { $this->view->doctype('XHTML1_STRICT'); $test = $this->helper->formText('foo', 'bar'); - $this->assertContains(' />', $test); + $this->assertStringContainsString(' />', $test); } } diff --git a/tests/Zend/View/Helper/GravatarTest.php b/tests/Zend/View/Helper/GravatarTest.php index 34aa394c..fdb74bb0 100644 --- a/tests/Zend/View/Helper/GravatarTest.php +++ b/tests/Zend/View/Helper/GravatarTest.php @@ -272,7 +272,6 @@ public function testInvalidKeyPassedToSetOptionsMethod() 'unknown' => array('val' => 1), ); $this->_object->gravatar()->setOptions($options); + self::assertTrue(true); } } - -// Call Zend_View_Helper_BaseUrlTest::main() if this source file is executed directly. diff --git a/tests/Zend/View/Helper/HeadLinkTest.php b/tests/Zend/View/Helper/HeadLinkTest.php index c4a9d8c3..42f17a21 100644 --- a/tests/Zend/View/Helper/HeadLinkTest.php +++ b/tests/Zend/View/Helper/HeadLinkTest.php @@ -108,6 +108,7 @@ public function testPrependThrowsExceptionWithoutArrayArgument() $this->fail('prepend should raise exception without array argument'); } catch (Exception $e) { } + self::assertTrue(true); } public function testAppendThrowsExceptionWithoutArrayArgument() @@ -117,6 +118,7 @@ public function testAppendThrowsExceptionWithoutArrayArgument() $this->fail('append should raise exception without array argument'); } catch (Exception $e) { } + self::assertTrue(true); } public function testSetThrowsExceptionWithoutArrayArgument() @@ -126,6 +128,7 @@ public function testSetThrowsExceptionWithoutArrayArgument() $this->fail('set should raise exception without array argument'); } catch (Exception $e) { } + self::assertTrue(true); } public function testOffsetSetThrowsExceptionWithoutArrayArgument() @@ -135,6 +138,7 @@ public function testOffsetSetThrowsExceptionWithoutArrayArgument() $this->fail('set should raise exception without array argument'); } catch (Exception $e) { } + self::assertTrue(true); } public function testCreatingLinkStackViaHeadScriptCreatesAppropriateOutput() @@ -156,11 +160,11 @@ public function testCreatingLinkStackViaHeadScriptCreatesAppropriateOutput() foreach ($links as $link) { $substr = ' href="' . $link['href'] . '"'; - $this->assertContains($substr, $string); + $this->assertStringContainsString($substr, $string); $substr = ' rel="' . $link['rel'] . '"'; - $this->assertContains($substr, $string); + $this->assertStringContainsString($substr, $string); $substr = ' type="' . $link['type'] . '"'; - $this->assertContains($substr, $string); + $this->assertStringContainsString($substr, $string); } $order = array(); @@ -192,11 +196,11 @@ public function testCreatingLinkStackViaStyleSheetMethodsCreatesAppropriateOutpu foreach ($links as $link) { $substr = ' href="' . $link['href'] . '"'; - $this->assertContains($substr, $string); + $this->assertStringContainsString($substr, $string); $substr = ' rel="' . $link['rel'] . '"'; - $this->assertContains($substr, $string); + $this->assertStringContainsString($substr, $string); $substr = ' type="' . $link['type'] . '"'; - $this->assertContains($substr, $string); + $this->assertStringContainsString($substr, $string); } $order = array(); @@ -233,11 +237,11 @@ public function testCreatingLinkStackViaAlternateMethodsCreatesAppropriateOutput foreach ($links as $link) { $substr = ' href="' . $link['href'] . '"'; - $this->assertContains($substr, $string); + $this->assertStringContainsString($substr, $string); $substr = ' title="' . $link['title'] . '"'; - $this->assertContains($substr, $string); + $this->assertStringContainsString($substr, $string); $substr = ' type="' . $link['type'] . '"'; - $this->assertContains($substr, $string); + $this->assertStringContainsString($substr, $string); } $order = array(); @@ -257,6 +261,7 @@ public function testOverloadingThrowsExceptionWithNoArguments() $this->fail('Helper should expect at least one argument'); } catch (Zend_View_Exception $e) { } + self::assertTrue(true); } public function testOverloadingShouldAllowSingleArrayArgument() @@ -273,6 +278,7 @@ public function testOverloadingUsingSingleArrayArgumentWithInvalidValuesThrowsEx $this->fail('Invalid attribute values should raise exception'); } catch (Zend_View_Exception $e) { } + self::assertTrue(true); } public function testOverloadingOffsetSetWorks() @@ -291,6 +297,7 @@ public function testOverloadingThrowsExceptionWithInvalidMethod() $this->fail('Invalid method should raise exception'); } catch (Zend_View_Exception $e) { } + self::assertTrue(true); } public function testStylesheetAttributesGetSet() @@ -312,10 +319,10 @@ public function testConditionalStylesheetNotCreatedByDefault() $this->assertFalse($item->conditionalStylesheet); $string = $this->helper->toString(); - $this->assertContains('/styles.css', $string); - $this->assertNotContains('', $string); + $this->assertStringContainsString('/styles.css', $string); + $this->assertStringNotContainsString('', $string); } public function testConditionalStylesheetCreationOccursWhenRequested() @@ -326,9 +333,9 @@ public function testConditionalStylesheetCreationOccursWhenRequested() $this->assertEquals('ie6', $item->conditionalStylesheet); $string = $this->helper->toString(); - $this->assertContains('/styles.css', $string); - $this->assertContains('', $string); + $this->assertStringContainsString('/styles.css', $string); + $this->assertStringContainsString('', $string); } public function testSettingAlternateWithTooFewArgsRaisesException() @@ -344,6 +351,7 @@ public function testSettingAlternateWithTooFewArgsRaisesException() $this->fail('Setting alternate with fewer than 3 args should raise exception'); } catch (Zend_View_Exception $e) { } + self::assertTrue(true); } public function testIndentationIsHonored() @@ -363,7 +371,7 @@ public function testLinkRendersAsPlainHtmlIfDoctypeNotXhtml() $this->helper->headLink(array('rel' => 'icon', 'src' => '/foo/bar')) ->headLink(array('rel' => 'foo', 'href' => '/bar/baz')); $test = $this->helper->toString(); - $this->assertNotContains(' />', $test); + $this->assertStringNotContainsString(' />', $test); } public function testDoesNotAllowDuplicateStylesheets() @@ -380,7 +388,7 @@ public function testBooleanStylesheet() { $this->helper->appendStylesheet(array('href' => '/bar/baz', 'conditionalStylesheet' => false)); $test = $this->helper->toString(); - $this->assertNotContains('[if false]', $test); + $this->assertStringNotContainsString('[if false]', $test); } /** @@ -390,8 +398,8 @@ public function testBooleanTrueConditionalStylesheet() { $this->helper->appendStylesheet(array('href' => '/bar/baz', 'conditionalStylesheet' => true)); $test = $this->helper->toString(); - $this->assertNotContains('[if 1]', $test); - $this->assertNotContains('[if true]', $test); + $this->assertStringNotContainsString('[if 1]', $test); + $this->assertStringNotContainsString('[if true]', $test); } /** @@ -402,28 +410,28 @@ public function testBooleanTrueConditionalStylesheet() public function testTurnOffAutoEscapeDoesNotEncodeAmpersand() { $this->helper->setAutoEscape(false)->appendStylesheet('/css/rules.css?id=123&foo=bar'); - $this->assertContains('id=123&foo=bar', $this->helper->toString()); + $this->assertStringContainsString('id=123&foo=bar', $this->helper->toString()); } public function testSetAlternateWithExtras() { $this->helper->setAlternate('/mydocument.pdf', 'application/pdf', 'foo', array('media' => array('print','screen'))); $test = $this->helper->toString(); - $this->assertContains('media="print,screen"', $test); + $this->assertStringContainsString('media="print,screen"', $test); } public function testAppendStylesheetWithExtras() { $this->helper->appendStylesheet(array('href' => '/bar/baz', 'conditionalStylesheet' => false, 'extras' => array('id' => 'my_link_tag'))); $test = $this->helper->toString(); - $this->assertContains('id="my_link_tag"', $test); + $this->assertStringContainsString('id="my_link_tag"', $test); } public function testSetStylesheetWithMediaAsArray() { $this->helper->appendStylesheet('/bar/baz', array('screen','print')); $test = $this->helper->toString(); - $this->assertContains(' media="screen,print"', $test); + $this->assertStringContainsString(' media="screen,print"', $test); } /** @@ -452,7 +460,7 @@ public function testContainerMaintainsCorrectOrderOfItems() public function testIdAttributeIsSupported() { $this->helper->appendStylesheet(array('href' => '/bar/baz', 'id' => 'foo')); - $this->assertContains('id="foo"', $this->helper->toString()); + $this->assertStringContainsString('id="foo"', $this->helper->toString()); } /** @@ -462,7 +470,7 @@ public function testHeadLinkAllowsOverrideOfRelAttribute() { $this->helper->appendStylesheet('/css/auth.less', 'all', null, array('rel' => 'stylesheet/less')); $this->assertEquals(1, substr_count($this->helper->toString(), 'rel="')); - $this->assertContains('rel="stylesheet/less"', $this->helper->toString()); + $this->assertStringContainsString('rel="stylesheet/less"', $this->helper->toString()); } /** @@ -494,9 +502,9 @@ public function testConditionalStylesheetCreationNoIE() $this->assertObjectHasAttribute('conditionalStylesheet', $item); $this->assertEquals('!IE', $item->conditionalStylesheet); $string = $this->helper->toString(); - $this->assertContains('/styles.css', $string); - $this->assertContains('<', $string); - $this->assertContains('', $string); + $this->assertStringContainsString('/styles.css', $string); + $this->assertStringContainsString('<', $string); + $this->assertStringContainsString('', $string); } /** @@ -509,8 +517,8 @@ public function testConditionalStylesheetCreationNoIEWidthSpaces() $this->assertObjectHasAttribute('conditionalStylesheet', $item); $this->assertEquals('! IE', $item->conditionalStylesheet); $string = $this->helper->toString(); - $this->assertContains('/styles.css', $string); - $this->assertContains('<', $string); - $this->assertContains('', $string); + $this->assertStringContainsString('/styles.css', $string); + $this->assertStringContainsString('<', $string); + $this->assertStringContainsString('', $string); } } diff --git a/tests/Zend/View/Helper/HeadMetaTest.php b/tests/Zend/View/Helper/HeadMetaTest.php index b63ab3c2..ca69db83 100644 --- a/tests/Zend/View/Helper/HeadMetaTest.php +++ b/tests/Zend/View/Helper/HeadMetaTest.php @@ -133,6 +133,7 @@ public function testAppendPrependAndSetThrowExceptionsWhenNonMetaValueProvided() $this->fail('Non-meta value should not set'); } catch (Zend_View_Exception $e) { } + self::assertTrue(true); } protected function _inflectAction($type) @@ -243,6 +244,7 @@ public function testOverloadingThrowsExceptionWithFewerThanTwoArgs() $this->fail('Overloading should require at least two arguments'); } catch (Zend_View_Exception $e) { } + self::assertTrue(true); } public function testOverloadingThrowsExceptionWithInvalidMethodType() @@ -252,6 +254,7 @@ public function testOverloadingThrowsExceptionWithInvalidMethodType() $this->fail('Overloading should only work for (set|prepend|append)(Name|HttpEquiv)'); } catch (Zend_View_Exception $e) { } + self::assertTrue(true); } public function testCanBuildMetaTagsWithAttributes() @@ -283,13 +286,13 @@ public function testToStringReturnsValidHtml() $metas = substr_count($string, 'http-equiv="'); $this->assertEquals(1, $metas); - $this->assertContains('http-equiv="screen" content="projection"', $string); - $this->assertContains('name="keywords" content="foo bar"', $string); - $this->assertContains('lang="us_en"', $string); - $this->assertContains('scheme="foo"', $string); - $this->assertNotContains('bogus', $string); - $this->assertNotContains('unused', $string); - $this->assertContains('name="title" content="boo bah"', $string); + $this->assertStringContainsString('http-equiv="screen" content="projection"', $string); + $this->assertStringContainsString('name="keywords" content="foo bar"', $string); + $this->assertStringContainsString('lang="us_en"', $string); + $this->assertStringContainsString('scheme="foo"', $string); + $this->assertStringNotContainsString('bogus', $string); + $this->assertStringNotContainsString('unused', $string); + $this->assertStringContainsString('name="title" content="boo bah"', $string); } /** @@ -343,9 +346,9 @@ public function testStringRepresentationReflectsDoctype() $this->view->doctype('HTML4_STRICT'); $this->helper->headMeta('some content', 'foo'); $test = $this->helper->toString(); - $this->assertNotContains('/>', $test); - $this->assertContains('some content', $test); - $this->assertContains('foo', $test); + $this->assertStringNotContainsString('/>', $test); + $this->assertStringContainsString('some content', $test); + $this->assertStringContainsString('foo', $test); } /** @@ -369,7 +372,7 @@ public function testPropertyIsNotSupportedByDefaultDoctype() $this->helper->headMeta('foo', 'og:title', 'property'); $this->fail('meta property attribute should not be supported on default doctype'); } catch (Zend_View_Exception $e) { - $this->assertContains('Invalid value passed', $e->getMessage()); + $this->assertStringContainsString('Invalid value passed', $e->getMessage()); } } @@ -488,6 +491,7 @@ public function testCharsetValidateFail() $this->fail('Should not be able to set charset for a HTML4 doctype'); } catch (Zend_View_Exception $e) { } + self::assertTrue(true); } /** @@ -538,8 +542,8 @@ public function testStandaloneInstantiationWithoutViewDoesNotCauseFatalError() public function testConditionalNoIE() { $html = $this->helper->appendHttpEquiv('foo', 'bar', array('conditional' => '!IE'))->toString(); - $this->assertContains('<', $html); - $this->assertContains('', $html); + $this->assertStringContainsString('<', $html); + $this->assertStringContainsString('', $html); } /** @@ -548,7 +552,7 @@ public function testConditionalNoIE() public function testConditionalNoIEWidthSpace() { $html = $this->helper->appendHttpEquiv('foo', 'bar', array('conditional' => '! IE'))->toString(); - $this->assertContains('<', $html); - $this->assertContains('', $html); + $this->assertStringContainsString('<', $html); + $this->assertStringContainsString('', $html); } } diff --git a/tests/Zend/View/Helper/HeadScriptTest.php b/tests/Zend/View/Helper/HeadScriptTest.php index 6f8d2f81..e23912f1 100644 --- a/tests/Zend/View/Helper/HeadScriptTest.php +++ b/tests/Zend/View/Helper/HeadScriptTest.php @@ -120,6 +120,7 @@ public function testSetPrependAppendAndOffsetSetThrowExceptionsOnInvalidItems() $this->fail('Set should throw exception with invalid item'); } catch (Zend_View_Exception $e) { } + self::assertTrue(true); } protected function _inflectAction($type) @@ -245,6 +246,7 @@ public function testOverloadingThrowsExceptionWithInvalidMethod() $this->fail('Invalid method should raise exception'); } catch (Zend_View_Exception $e) { } + self::assertTrue(true); } public function testOverloadingWithTooFewArgumentsRaisesException() @@ -260,6 +262,7 @@ public function testOverloadingWithTooFewArgumentsRaisesException() $this->fail('Too few arguments should raise exception'); } catch (Zend_View_Exception $e) { } + self::assertTrue(true); } public function testHeadScriptAppropriatelySetsScriptItems() @@ -307,9 +310,9 @@ public function testToStringRendersValidHtml() $scripts = substr_count($string, '><'); $this->assertEquals(1, $scripts); - $this->assertContains('src="foo"', $string); - $this->assertContains('bar', $string); - $this->assertContains('baz', $string); + $this->assertStringContainsString('src="foo"', $string); + $this->assertStringContainsString('bar', $string); + $this->assertStringContainsString('baz', $string); $doc = new DOMDocument(); $dom = $doc->loadHtml($string); @@ -340,10 +343,10 @@ public function testIndentationIsHonored() $scripts = substr_count($string, ' assertEquals(2, $scripts); - $this->assertContains(' //', $string); - $this->assertContains('var', $string); - $this->assertContains('document', $string); - $this->assertContains(' document', $string); + $this->assertStringContainsString(' //', $string); + $this->assertStringContainsString('var', $string); + $this->assertStringContainsString('document', $string); + $this->assertStringContainsString(' document', $string); } public function testDoesNotAllowDuplicateFiles() @@ -357,7 +360,7 @@ public function testRenderingDoesNotRenderArbitraryAttributesByDefault() { $this->helper->headScript()->appendFile('/js/foo.js', 'text/javascript', array('bogus' => 'deferred')); $test = $this->helper->headScript()->toString(); - $this->assertNotContains('bogus="deferred"', $test); + $this->assertStringNotContainsString('bogus="deferred"', $test); } public function testCanRenderArbitraryAttributesOnRequest() @@ -365,7 +368,7 @@ public function testCanRenderArbitraryAttributesOnRequest() $this->helper->headScript()->appendFile('/js/foo.js', 'text/javascript', array('bogus' => 'deferred')) ->setAllowArbitraryAttributes(true); $test = $this->helper->headScript()->toString(); - $this->assertContains('bogus="deferred"', $test); + $this->assertStringContainsString('bogus="deferred"', $test); } public function testCanPerformMultipleSerialCaptures() @@ -381,6 +384,7 @@ public function testCanPerformMultipleSerialCaptures() } echo 'this is something else captured'; $this->helper->headScript()->captureEnd(); + self::assertTrue(true); } public function testCannotNestCaptures() @@ -394,7 +398,7 @@ public function testCannotNestCaptures() $this->fail('Should not be able to nest captures'); } catch (Zend_View_Exception $e) { $this->helper->headScript()->captureEnd(); - $this->assertContains('Cannot nest', $e->getMessage()); + $this->assertStringContainsString('Cannot nest', $e->getMessage()); } } @@ -413,7 +417,7 @@ public function testConditionalScript() { $this->helper->headScript()->appendFile('/js/foo.js', 'text/javascript', array('conditional' => 'lt IE 7')); $test = $this->helper->headScript()->toString(); - $this->assertContains('', $test); + $this->assertStringContainsString('//', $test); } /** @@ -510,8 +514,8 @@ public function testNoEscapeTrue() ); $test = $this->helper->toString(); - $this->assertNotContains('//', $test); + $this->assertStringNotContainsString('//', $test); } /** @@ -524,7 +528,7 @@ public function testConditionalScriptNoIE() '/js/foo.js', 'text/javascript', array('conditional' => '!IE') ); $test = $this->helper->toString(); - $this->assertContains('<', $test); - $this->assertContains('', $test); + $this->assertStringContainsString('<', $test); + $this->assertStringContainsString('', $test); } } diff --git a/tests/Zend/View/Helper/HeadStyleTest.php b/tests/Zend/View/Helper/HeadStyleTest.php index e1a090fc..01c94a65 100644 --- a/tests/Zend/View/Helper/HeadStyleTest.php +++ b/tests/Zend/View/Helper/HeadStyleTest.php @@ -120,6 +120,7 @@ public function testAppendPrependAndSetThrowExceptionsWhenNonStyleValueProvided( $this->fail('Non-style value should not set'); } catch (Zend_View_Exception $e) { } + self::assertTrue(true); } public function testOverloadAppendStyleAppendsStyleToStack() @@ -210,8 +211,8 @@ public function testRenderedStyleTagsContainHtmlEscaping() 'bogus' => 'unused', )); $value = $this->helper->toString(); - $this->assertContains('', $value); + $this->assertStringContainsString('', $value); } public function testRenderedStyleTagsContainsDefaultMedia() @@ -229,7 +230,7 @@ public function testMediaAttributeCanHaveSpaceInCommaSeparatedString() { $this->helper->appendStyle('a { }', array('media' => 'screen, projection')); $string = $this->helper->toString(); - $this->assertContains('media="screen,projection"', $string); + $this->assertStringContainsString('media="screen,projection"', $string); } public function testHeadStyleProxiesProperly() @@ -266,9 +267,9 @@ public function testToStyleGeneratesValidHtml() $this->assertEquals(3, $styles); $styles = substr_count($html, ''); $this->assertEquals(3, $styles); - $this->assertContains($style3, $html); - $this->assertContains($style2, $html); - $this->assertContains($style1, $html); + $this->assertStringContainsString($style3, $html); + $this->assertStringContainsString($style2, $html); + $this->assertStringContainsString($style1, $html); } public function testCapturingCapturesToObject() @@ -299,6 +300,7 @@ public function testInvalidMethodRaisesException() $this->fail('Invalid method should raise exception'); } catch (Zend_View_Exception $e) { } + self::assertTrue(true); } public function testTooFewArgumentsRaisesException() @@ -308,6 +310,7 @@ public function testTooFewArgumentsRaisesException() $this->fail('Too few arguments should raise exception'); } catch (Zend_View_Exception $e) { } + self::assertTrue(true); } public function testIndentationIsHonored() @@ -325,12 +328,12 @@ public function testIndentationIsHonored() $scripts = substr_count($string, ' assertEquals(2, $scripts); - $this->assertContains(' ', $value); + $this->assertStringNotContainsString('', $value); } /** @@ -455,8 +459,8 @@ public function testConditionalScriptNoIE() display: none; }', array('media' => 'screen,projection', 'conditional' => '!IE')); $test = $this->helper->toString(); - $this->assertContains('<', $test); - $this->assertContains('', $test); + $this->assertStringContainsString('<', $test); + $this->assertStringContainsString('', $test); } /** @@ -469,7 +473,7 @@ public function testConditionalScriptNoIEWidthSpace() display: none; }', array('media' => 'screen,projection', 'conditional' => '! IE')); $test = $this->helper->toString(); - $this->assertContains('<', $test); - $this->assertContains('', $test); + $this->assertStringContainsString('<', $test); + $this->assertStringContainsString('', $test); } } diff --git a/tests/Zend/View/Helper/HeadTitleTest.php b/tests/Zend/View/Helper/HeadTitleTest.php index d46cc4dc..e56ba98a 100644 --- a/tests/Zend/View/Helper/HeadTitleTest.php +++ b/tests/Zend/View/Helper/HeadTitleTest.php @@ -98,21 +98,21 @@ public function testHeadTitleReturnsObjectInstance() public function testCanSetTitleViaHeadTitle() { $placeholder = $this->helper->headTitle('Foo Bar', 'SET'); - $this->assertContains('Foo Bar', $placeholder->toString()); + $this->assertStringContainsString('Foo Bar', $placeholder->toString()); } public function testCanAppendTitleViaHeadTitle() { $placeholder = $this->helper->headTitle('Foo'); $placeholder = $this->helper->headTitle('Bar'); - $this->assertContains('FooBar', $placeholder->toString()); + $this->assertStringContainsString('FooBar', $placeholder->toString()); } public function testCanPrependTitleViaHeadTitle() { $placeholder = $this->helper->headTitle('Foo'); $placeholder = $this->helper->headTitle('Bar', 'PREPEND'); - $this->assertContains('BarFoo', $placeholder->toString()); + $this->assertStringContainsString('BarFoo', $placeholder->toString()); } public function testReturnedPlaceholderToStringContainsFullTitleElement() @@ -126,8 +126,8 @@ public function testToStringEscapesEntries() { $this->helper->headTitle(''); $string = $this->helper->toString(); - $this->assertNotContains('assertNotContains('', $string); + $this->assertStringNotContainsString('assertStringNotContainsString('', $string); } public function testToStringEscapesSeparator() @@ -136,10 +136,10 @@ public function testToStringEscapesSeparator() ->headTitle('Bar') ->setSeparator('
'); $string = $this->helper->toString(); - $this->assertNotContains('
', $string); - $this->assertContains('Foo', $string); - $this->assertContains('Bar', $string); - $this->assertContains('br /', $string); + $this->assertStringNotContainsString('
', $string); + $this->assertStringContainsString('Foo', $string); + $this->assertStringContainsString('Bar', $string); + $this->assertStringContainsString('br /', $string); } public function testIndentationIsHonored() @@ -148,7 +148,7 @@ public function testIndentationIsHonored() $this->helper->headTitle('foo'); $string = $this->helper->toString(); - $this->assertContains(' ', $string); + $this->assertStringContainsString(' <title>', $string); } public function testAutoEscapeIsHonored() @@ -217,7 +217,7 @@ public function testCanPrependTitlesUsingDefaultAttachOrder() $this->helper->setDefaultAttachOrder('PREPEND'); $placeholder = $this->helper->headTitle('Foo'); $placeholder = $this->helper->headTitle('Bar'); - $this->assertContains('BarFoo', $placeholder->toString()); + $this->assertStringContainsString('BarFoo', $placeholder->toString()); } /** diff --git a/tests/Zend/View/Helper/HtmlFlashTest.php b/tests/Zend/View/Helper/HtmlFlashTest.php index e9b0a9b2..306f35f1 100644 --- a/tests/Zend/View/Helper/HtmlFlashTest.php +++ b/tests/Zend/View/Helper/HtmlFlashTest.php @@ -64,7 +64,7 @@ public function testMakeHtmlFlash() $objectStartElement = '<object data="/path/to/flash.swf" type="application/x-shockwave-flash">'; - $this->assertContains($objectStartElement, $htmlFlash); - $this->assertContains('</object>', $htmlFlash); + $this->assertStringContainsString($objectStartElement, $htmlFlash); + $this->assertStringContainsString('</object>', $htmlFlash); } } diff --git a/tests/Zend/View/Helper/HtmlListTest.php b/tests/Zend/View/Helper/HtmlListTest.php index 2a6139fb..883b8d2e 100644 --- a/tests/Zend/View/Helper/HtmlListTest.php +++ b/tests/Zend/View/Helper/HtmlListTest.php @@ -64,10 +64,10 @@ public function testMakeUnorderedList() $list = $this->helper->htmlList($items); - $this->assertContains('<ul>', $list); - $this->assertContains('</ul>', $list); + $this->assertStringContainsString('<ul>', $list); + $this->assertStringContainsString('</ul>', $list); foreach ($items as $item) { - $this->assertContains('<li>' . $item . '</li>', $list); + $this->assertStringContainsString('<li>' . $item . '</li>', $list); } } @@ -77,10 +77,10 @@ public function testMakeOrderedList() $list = $this->helper->htmlList($items, true); - $this->assertContains('<ol>', $list); - $this->assertContains('</ol>', $list); + $this->assertStringContainsString('<ol>', $list); + $this->assertStringContainsString('</ol>', $list); foreach ($items as $item) { - $this->assertContains('<li>' . $item . '</li>', $list); + $this->assertStringContainsString('<li>' . $item . '</li>', $list); } } @@ -91,12 +91,12 @@ public function testMakeUnorderedListWithAttribs() $list = $this->helper->htmlList($items, false, $attribs); - $this->assertContains('<ul', $list); - $this->assertContains('class="selected"', $list); - $this->assertContains('name="list"', $list); - $this->assertContains('</ul>', $list); + $this->assertStringContainsString('<ul', $list); + $this->assertStringContainsString('class="selected"', $list); + $this->assertStringContainsString('name="list"', $list); + $this->assertStringContainsString('</ul>', $list); foreach ($items as $item) { - $this->assertContains('<li>' . $item . '</li>', $list); + $this->assertStringContainsString('<li>' . $item . '</li>', $list); } } @@ -107,12 +107,12 @@ public function testMakeOrderedListWithAttribs() $list = $this->helper->htmlList($items, true, $attribs); - $this->assertContains('<ol', $list); - $this->assertContains('class="selected"', $list); - $this->assertContains('name="list"', $list); - $this->assertContains('</ol>', $list); + $this->assertStringContainsString('<ol', $list); + $this->assertStringContainsString('class="selected"', $list); + $this->assertStringContainsString('name="list"', $list); + $this->assertStringContainsString('</ol>', $list); foreach ($items as $item) { - $this->assertContains('<li>' . $item . '</li>', $list); + $this->assertStringContainsString('<li>' . $item . '</li>', $list); } } @@ -123,10 +123,10 @@ public function testMakeNestedUnorderedList() $list = $this->helper->htmlList($items); - $this->assertContains('<ul>' . Zend_View_Helper_HtmlList::EOL, $list); - $this->assertContains('</ul>' . Zend_View_Helper_HtmlList::EOL, $list); - $this->assertContains('one<ul>' . Zend_View_Helper_HtmlList::EOL . '<li>four', $list); - $this->assertContains('<li>six</li>' . Zend_View_Helper_HtmlList::EOL . '</ul>' + $this->assertStringContainsString('<ul>' . Zend_View_Helper_HtmlList::EOL, $list); + $this->assertStringContainsString('</ul>' . Zend_View_Helper_HtmlList::EOL, $list); + $this->assertStringContainsString('one<ul>' . Zend_View_Helper_HtmlList::EOL . '<li>four', $list); + $this->assertStringContainsString('<li>six</li>' . Zend_View_Helper_HtmlList::EOL . '</ul>' . Zend_View_Helper_HtmlList::EOL . '</li>' . Zend_View_Helper_HtmlList::EOL . '<li>two', $list); } @@ -137,11 +137,11 @@ public function testMakeNestedDeepUnorderedList() $list = $this->helper->htmlList($items); - $this->assertContains('<ul>' . Zend_View_Helper_HtmlList::EOL, $list); - $this->assertContains('</ul>' . Zend_View_Helper_HtmlList::EOL, $list); - $this->assertContains('one<ul>' . Zend_View_Helper_HtmlList::EOL . '<li>four', $list); - $this->assertContains('<li>four<ul>' . Zend_View_Helper_HtmlList::EOL . '<li>six', $list); - $this->assertContains('<li>five</li>' . Zend_View_Helper_HtmlList::EOL . '</ul>' + $this->assertStringContainsString('<ul>' . Zend_View_Helper_HtmlList::EOL, $list); + $this->assertStringContainsString('</ul>' . Zend_View_Helper_HtmlList::EOL, $list); + $this->assertStringContainsString('one<ul>' . Zend_View_Helper_HtmlList::EOL . '<li>four', $list); + $this->assertStringContainsString('<li>four<ul>' . Zend_View_Helper_HtmlList::EOL . '<li>six', $list); + $this->assertStringContainsString('<li>five</li>' . Zend_View_Helper_HtmlList::EOL . '</ul>' . Zend_View_Helper_HtmlList::EOL . '</li>' . Zend_View_Helper_HtmlList::EOL . '<li>two', $list); } @@ -151,12 +151,12 @@ public function testListWithValuesToEscapeForZF2283() $list = $this->helper->htmlList($items); - $this->assertContains('<ul>', $list); - $this->assertContains('</ul>', $list); + $this->assertStringContainsString('<ul>', $list); + $this->assertStringContainsString('</ul>', $list); - $this->assertContains('<li>one <small> test</li>', $list); - $this->assertContains('<li>second & third</li>', $list); - $this->assertContains('<li>And \'some\' "final" test</li>', $list); + $this->assertStringContainsString('<li>one <small> test</li>', $list); + $this->assertStringContainsString('<li>second & third</li>', $list); + $this->assertStringContainsString('<li>And \'some\' "final" test</li>', $list); } public function testListEscapeSwitchedOffForZF2283() @@ -165,10 +165,10 @@ public function testListEscapeSwitchedOffForZF2283() $list = $this->helper->htmlList($items, false, false, false); - $this->assertContains('<ul>', $list); - $this->assertContains('</ul>', $list); + $this->assertStringContainsString('<ul>', $list); + $this->assertStringContainsString('</ul>', $list); - $this->assertContains('<li>one <b>small</b> test</li>', $list); + $this->assertStringContainsString('<li>one <b>small</b> test</li>', $list); } /** @@ -181,7 +181,7 @@ public function testEscapeFlagHonoredForMultidimensionalLists() $list = $this->helper->htmlList($items, false, false, false); foreach ($items[1] as $item) { - $this->assertContains($item, $list); + $this->assertStringContainsString($item, $list); } } diff --git a/tests/Zend/View/Helper/HtmlObjectTest.php b/tests/Zend/View/Helper/HtmlObjectTest.php index ce210cdc..b11b47fd 100644 --- a/tests/Zend/View/Helper/HtmlObjectTest.php +++ b/tests/Zend/View/Helper/HtmlObjectTest.php @@ -67,8 +67,8 @@ public function testMakeHtmlObjectWithoutAttribsWithoutParams() { $htmlObject = $this->helper->htmlObject('datastring', 'typestring'); - $this->assertContains('<object data="datastring" type="typestring">', $htmlObject); - $this->assertContains('</object>', $htmlObject); + $this->assertStringContainsString('<object data="datastring" type="typestring">', $htmlObject); + $this->assertStringContainsString('</object>', $htmlObject); } public function testMakeHtmlObjectWithAttribsWithoutParams() @@ -78,8 +78,8 @@ public function testMakeHtmlObjectWithAttribsWithoutParams() $htmlObject = $this->helper->htmlObject('datastring', 'typestring', $attribs); - $this->assertContains('<object data="datastring" type="typestring" attribkey1="attribvalue1" attribkey2="attribvalue2">', $htmlObject); - $this->assertContains('</object>', $htmlObject); + $this->assertStringContainsString('<object data="datastring" type="typestring" attribkey1="attribvalue1" attribkey2="attribvalue2">', $htmlObject); + $this->assertStringContainsString('</object>', $htmlObject); } public function testMakeHtmlObjectWithoutAttribsWithParamsHtml() @@ -91,13 +91,13 @@ public function testMakeHtmlObjectWithoutAttribsWithParamsHtml() $htmlObject = $this->helper->htmlObject('datastring', 'typestring', array(), $params); - $this->assertContains('<object data="datastring" type="typestring">', $htmlObject); - $this->assertContains('</object>', $htmlObject); + $this->assertStringContainsString('<object data="datastring" type="typestring">', $htmlObject); + $this->assertStringContainsString('</object>', $htmlObject); foreach ($params as $key => $value) { $param = '<param name="' . $key . '" value="' . $value . '">'; - $this->assertContains($param, $htmlObject); + $this->assertStringContainsString($param, $htmlObject); } } @@ -110,13 +110,13 @@ public function testMakeHtmlObjectWithoutAttribsWithParamsXhtml() $htmlObject = $this->helper->htmlObject('datastring', 'typestring', array(), $params); - $this->assertContains('<object data="datastring" type="typestring">', $htmlObject); - $this->assertContains('</object>', $htmlObject); + $this->assertStringContainsString('<object data="datastring" type="typestring">', $htmlObject); + $this->assertStringContainsString('</object>', $htmlObject); foreach ($params as $key => $value) { $param = '<param name="' . $key . '" value="' . $value . '" />'; - $this->assertContains($param, $htmlObject); + $this->assertStringContainsString($param, $htmlObject); } } @@ -124,8 +124,8 @@ public function testMakeHtmlObjectWithContent() { $htmlObject = $this->helper->htmlObject('datastring', 'typestring', array(), array(), 'testcontent'); - $this->assertContains('<object data="datastring" type="typestring">', $htmlObject); - $this->assertContains('testcontent', $htmlObject); - $this->assertContains('</object>', $htmlObject); + $this->assertStringContainsString('<object data="datastring" type="typestring">', $htmlObject); + $this->assertStringContainsString('testcontent', $htmlObject); + $this->assertStringContainsString('</object>', $htmlObject); } } diff --git a/tests/Zend/View/Helper/HtmlPageTest.php b/tests/Zend/View/Helper/HtmlPageTest.php index cfb128b4..21fd509f 100644 --- a/tests/Zend/View/Helper/HtmlPageTest.php +++ b/tests/Zend/View/Helper/HtmlPageTest.php @@ -66,7 +66,7 @@ public function testMakeHtmlPage() . ' type="text/html"' . ' classid="clsid:25336920-03F9-11CF-8FD0-00AA00686F13">'; - $this->assertContains($objectStartElement, $htmlPage); - $this->assertContains('</object>', $htmlPage); + $this->assertStringContainsString($objectStartElement, $htmlPage); + $this->assertStringContainsString('</object>', $htmlPage); } } diff --git a/tests/Zend/View/Helper/HtmlQuicktimeTest.php b/tests/Zend/View/Helper/HtmlQuicktimeTest.php index c56ba8ab..9dc0348b 100644 --- a/tests/Zend/View/Helper/HtmlQuicktimeTest.php +++ b/tests/Zend/View/Helper/HtmlQuicktimeTest.php @@ -67,7 +67,7 @@ public function testMakeHtmlQuicktime() . ' classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"' . ' codebase="http://www.apple.com/qtactivex/qtplugin.cab">'; - $this->assertContains($objectStartElement, $htmlQuicktime); - $this->assertContains('</object>', $htmlQuicktime); + $this->assertStringContainsString($objectStartElement, $htmlQuicktime); + $this->assertStringContainsString('</object>', $htmlQuicktime); } } diff --git a/tests/Zend/View/Helper/Navigation/BreadcrumbsTest.php b/tests/Zend/View/Helper/Navigation/BreadcrumbsTest.php index ea1cfa9f..44d40742 100644 --- a/tests/Zend/View/Helper/Navigation/BreadcrumbsTest.php +++ b/tests/Zend/View/Helper/Navigation/BreadcrumbsTest.php @@ -226,6 +226,7 @@ public function testRenderingPartialShouldFailOnInvalidPartialArray() '$partial was invalid, but no Zend_View_Exception was thrown'); } catch (Zend_View_Exception $e) { } + self::assertTrue(true); } public function testLastBreadcrumbShouldBeEscaped() diff --git a/tests/Zend/View/Helper/Navigation/LinksTest.php b/tests/Zend/View/Helper/Navigation/LinksTest.php index 8d5c176a..f7284ed7 100644 --- a/tests/Zend/View/Helper/Navigation/LinksTest.php +++ b/tests/Zend/View/Helper/Navigation/LinksTest.php @@ -523,7 +523,7 @@ public function testFindRelationMustSpecifyRelOrRev() $this->fail('An invalid value was given, but a ' . 'Zend_View_Exception was not thrown'); } catch (Zend_View_Exception $e) { - $this->assertContains('Invalid argument: $rel', $e->getMessage()); + $this->assertStringContainsString('Invalid argument: $rel', $e->getMessage()); } } @@ -536,7 +536,7 @@ public function testRenderLinkMustSpecifyRelOrRev() $this->fail('An invalid value was given, but a ' . 'Zend_View_Exception was not thrown'); } catch (Zend_View_Exception $e) { - $this->assertContains('Invalid relation attribute', $e->getMessage()); + $this->assertStringContainsString('Invalid relation attribute', $e->getMessage()); } } diff --git a/tests/Zend/View/Helper/Navigation/MenuTest.php b/tests/Zend/View/Helper/Navigation/MenuTest.php index f9275ba3..e4d98ec6 100644 --- a/tests/Zend/View/Helper/Navigation/MenuTest.php +++ b/tests/Zend/View/Helper/Navigation/MenuTest.php @@ -333,6 +333,7 @@ public function testRenderingPartialShouldFailOnInvalidPartialArray() $this->fail('invalid $partial should throw Zend_View_Exception'); } catch (Zend_View_Exception $e) { } + self::assertTrue(true); } public function testSetMaxDepth() @@ -652,7 +653,7 @@ public function testRenderingWithUlId() { $this->_helper->setUlId('foo'); - $this->assertContains( + $this->assertStringContainsString( '<ul class="navigation" id="foo">', $this->_helper->renderMenu() ); @@ -663,7 +664,7 @@ public function testRenderingWithUlId() */ public function testRenderingWithUlIdPerOptions() { - $this->assertContains( + $this->assertStringContainsString( '<ul class="navigation" id="foo">', $this->_helper->renderMenu(null, array('ulId' => 'foo')) ); @@ -678,7 +679,7 @@ public function testRenderingOnlyActiveBranchWithUlId() ->setOnlyActiveBranch() ->setRenderParents(); - $this->assertContains( + $this->assertStringContainsString( '<ul class="navigation" id="foo">', $this->_helper->renderMenu() ); @@ -689,7 +690,7 @@ public function testRenderingOnlyActiveBranchWithUlId() */ public function testRenderingSubMenuWithUlId() { - $this->assertContains( + $this->assertStringContainsString( '<ul class="navigation" id="foo">', $this->_helper->renderSubMenu(null, null, null, 'foo') ); @@ -700,7 +701,7 @@ public function testRenderingSubMenuWithUlId() */ public function testRenderingDeepestMenuWithUlId() { - $this->assertContains( + $this->assertStringContainsString( '<ul class="navigation" id="foo">', $this->_helper->renderMenu(null, array('ulId' => 'foo')) ); @@ -727,11 +728,11 @@ public function testRenderingWithPageClassToLi() $container->findBy('href', 'page1')->setClass('foo'); // Tests - $this->assertContains( + $this->assertStringContainsString( '<li class="foo">', $this->_helper->renderMenu() ); - $this->assertNotContains( + $this->assertStringNotContainsString( '<a class="foo" href="page1">Page 1</a>', $this->_helper->renderMenu() ); @@ -753,11 +754,11 @@ public function testRenderDeepestMenuWithPageClassToLi() 'addPageClassToLi' => true, ); - $this->assertContains( + $this->assertStringContainsString( '<li class="active foo">', $this->_helper->renderMenu(null, $options) ); - $this->assertNotContains( + $this->assertStringNotContainsString( '<a class="foo" href="page1">Page 1</a>', $this->_helper->renderMenu(null, $options) ); @@ -792,8 +793,8 @@ public function testRenderDeepestMenuWithCustomActiveClass() $html = $this->_helper->renderMenu(null, $options); - $this->assertContains('<li class="current">', $html); - $this->assertNotContains('<li class="active">', $html); + $this->assertStringContainsString('<li class="current">', $html); + $this->assertStringNotContainsString('<li class="active">', $html); } /** diff --git a/tests/Zend/View/Helper/Navigation/NavigationTest.php b/tests/Zend/View/Helper/Navigation/NavigationTest.php index 3ca4e390..72e9bf55 100644 --- a/tests/Zend/View/Helper/Navigation/NavigationTest.php +++ b/tests/Zend/View/Helper/Navigation/NavigationTest.php @@ -257,7 +257,7 @@ public function testSetRoleThrowsExceptionWhenGivenAnInt() $this->fail('An invalid argument was given, but a ' . 'Zend_View_Exception was not thrown'); } catch (Zend_View_Exception $e) { - $this->assertContains('$role must be a string', $e->getMessage()); + $this->assertStringContainsString('$role must be a string', $e->getMessage()); } } @@ -268,7 +268,7 @@ public function testSetRoleThrowsExceptionWhenGivenAnArbitraryObject() $this->fail('An invalid argument was given, but a ' . 'Zend_View_Exception was not thrown'); } catch (Zend_View_Exception $e) { - $this->assertContains('$role must be a string', $e->getMessage()); + $this->assertStringContainsString('$role must be a string', $e->getMessage()); } } @@ -309,7 +309,7 @@ public function testSetDefaultRoleThrowsExceptionWhenGivenAnInt() $this->fail('An invalid argument was given, but a ' . 'Zend_View_Exception was not thrown'); } catch (Zend_View_Exception $e) { - $this->assertContains('$role must be', $e->getMessage()); + $this->assertStringContainsString('$role must be', $e->getMessage()); } } @@ -320,7 +320,7 @@ public function testSetDefaultRoleThrowsExceptionWhenGivenAnArbitraryObject() $this->fail('An invalid argument was given, but a ' . 'Zend_View_Exception was not thrown'); } catch (Zend_View_Exception $e) { - $this->assertContains('$role must be', $e->getMessage()); + $this->assertStringContainsString('$role must be', $e->getMessage()); } } diff --git a/tests/Zend/View/Helper/Navigation/SitemapTest.php b/tests/Zend/View/Helper/Navigation/SitemapTest.php index 87c0c3e9..4c309226 100644 --- a/tests/Zend/View/Helper/Navigation/SitemapTest.php +++ b/tests/Zend/View/Helper/Navigation/SitemapTest.php @@ -246,7 +246,7 @@ public function testSetServerUrlRequiresValidUri() $this->fail('An invalid server URL was given, but a ' . 'Zend_Uri_Exception was not thrown'); } catch (Zend_Uri_Exception $e) { - $this->assertContains('Illegal scheme', $e->getMessage()); + $this->assertStringContainsString('Illegal scheme', $e->getMessage()); } } diff --git a/tests/Zend/View/Helper/PaginationControlTest.php b/tests/Zend/View/Helper/PaginationControlTest.php index 44177f16..58eff931 100644 --- a/tests/Zend/View/Helper/PaginationControlTest.php +++ b/tests/Zend/View/Helper/PaginationControlTest.php @@ -83,7 +83,7 @@ public function testUsesDefaultViewPartialIfNoneSupplied() { Zend_View_Helper_PaginationControl::setDefaultViewPartial('testPagination.phtml'); $output = $this->_viewHelper->paginationControl($this->_paginator); - $this->assertContains('pagination control', $output, $output); + $this->assertStringContainsString('pagination control', $output, $output); Zend_View_Helper_PaginationControl::setDefaultViewPartial(null); } @@ -104,15 +104,15 @@ public function testUsesDefaultScrollingStyleIfNoneSupplied() { // First we'll make sure the base case works $output = $this->_viewHelper->paginationControl($this->_paginator, 'All', 'testPagination.phtml'); - $this->assertContains('page count (11) equals pages in range (11)', $output, $output); + $this->assertStringContainsString('page count (11) equals pages in range (11)', $output, $output); Zend_Paginator::setDefaultScrollingStyle('All'); $output = $this->_viewHelper->paginationControl($this->_paginator, null, 'testPagination.phtml'); - $this->assertContains('page count (11) equals pages in range (11)', $output, $output); + $this->assertStringContainsString('page count (11) equals pages in range (11)', $output, $output); Zend_View_Helper_PaginationControl::setDefaultViewPartial('testPagination.phtml'); $output = $this->_viewHelper->paginationControl($this->_paginator); - $this->assertContains('page count (11) equals pages in range (11)', $output, $output); + $this->assertStringContainsString('page count (11) equals pages in range (11)', $output, $output); } /** @@ -130,7 +130,7 @@ public function testUsesPaginatorFromViewIfNoneSupplied() $this->fail('Could not find paginator in the view instance'); } - $this->assertContains('pagination control', $output, $output); + $this->assertStringContainsString('pagination control', $output, $output); } /** @@ -174,7 +174,7 @@ public function testUsesPaginatorFromViewOnlyIfNoneSupplied() Zend_View_Helper_PaginationControl::setDefaultViewPartial('testPagination.phtml'); $output = $this->_viewHelper->paginationControl($paginator); - $this->assertContains('page count (3)', $output, $output); + $this->assertStringContainsString('page count (3)', $output, $output); } /** @@ -191,6 +191,6 @@ public function testCanUseObjectForScrollingStyle() $this->fail('Could not use object for sliding style'); } - $this->assertContains('page count (11) equals pages in range (11)', $output, $output); + $this->assertStringContainsString('page count (11) equals pages in range (11)', $output, $output); } } diff --git a/tests/Zend/View/Helper/PartialLoopTest.php b/tests/Zend/View/Helper/PartialLoopTest.php index 5dfe2707..40ab9a0a 100644 --- a/tests/Zend/View/Helper/PartialLoopTest.php +++ b/tests/Zend/View/Helper/PartialLoopTest.php @@ -91,7 +91,7 @@ public function testPartialLoopIteratesOverArray() $result = $this->helper->partialLoop('partialLoop.phtml', $data); foreach ($data as $item) { $string = 'This is an iteration: ' . $item['message']; - $this->assertContains($string, $result); + $this->assertStringContainsString($string, $result); } } @@ -113,7 +113,7 @@ public function testPartialLoopIteratesOverIterator() $result = $this->helper->partialLoop('partialLoop.phtml', $o); foreach ($data as $item) { $string = 'This is an iteration: ' . $item['message']; - $this->assertContains($string, $result); + $this->assertStringContainsString($string, $result); } } @@ -135,7 +135,7 @@ public function testPartialLoopIteratesOverRecursiveIterator() $result = $this->helper->partialLoop('partialLoop.phtml', $rIterator); foreach ($rIterator as $item) { foreach ($item as $key => $value) { - $this->assertContains($value, $result, var_export($value, 1)); + $this->assertStringContainsString($value, $result, var_export($value, 1)); } } } @@ -160,6 +160,7 @@ public function testPartialLoopThrowsExceptionWithBadIterator() $this->fail('PartialLoop should only work with arrays and iterators'); } catch (Exception) { } + self::assertTrue(true); } public function testPartialLoopFindsModule() @@ -180,7 +181,7 @@ public function testPartialLoopFindsModule() $result = $this->helper->partialLoop('partialLoop.phtml', 'foo', $data); foreach ($data as $item) { $string = 'This is an iteration in the foo module: ' . $item['message']; - $this->assertContains($string, $result); + $this->assertStringContainsString($string, $result); } } @@ -208,7 +209,7 @@ public function testShouldAllowIteratingOverTraversableObjects() $result = $this->helper->partialLoop('partialLoop.phtml', $o); foreach ($data as $item) { $string = 'This is an iteration: ' . $item['message']; - $this->assertContains($string, $result); + $this->assertStringContainsString($string, $result); } } @@ -230,7 +231,7 @@ public function testShouldAllowIteratingOverObjectsImplementingToArray() $result = $this->helper->partialLoop('partialLoop.phtml', $o); foreach ($data as $item) { $string = 'This is an iteration: ' . $item['message']; - $this->assertContains($string, $result, $result); + $this->assertStringContainsString($string, $result, $result); } } @@ -257,7 +258,7 @@ public function testShouldNotCastToArrayIfObjectIsTraversable() $result = $this->helper->partialLoop('partialLoopObject.phtml', $o); foreach ($data as $item) { $string = 'This is an iteration: ' . $item->message; - $this->assertContains($string, $result, $result); + $this->assertStringContainsString($string, $result, $result); } } @@ -282,6 +283,7 @@ public function testEmptyArrayPassedToPartialLoopShouldNotThrowException() } catch (Exception) { $this->fail('Empty array should not cause partialLoop to throw exception'); } + self::assertTrue(true); } /** @@ -306,7 +308,7 @@ public function testPartialLoopIncramentsPartialCounter() $result = $this->helper->partialLoop('partialLoopCouter.phtml', $data); foreach ($data as $key => $item) { $string = 'This is an iteration: ' . $item['message'] . ', pointer at ' . ($key + 1); - $this->assertContains($string, $result); + $this->assertStringContainsString($string, $result); } } @@ -332,13 +334,13 @@ public function testPartialLoopPartialCounterResets() $result = $this->helper->partialLoop('partialLoopCouter.phtml', $data); foreach ($data as $key => $item) { $string = 'This is an iteration: ' . $item['message'] . ', pointer at ' . ($key + 1); - $this->assertContains($string, $result); + $this->assertStringContainsString($string, $result); } $result = $this->helper->partialLoop('partialLoopCouter.phtml', $data); foreach ($data as $key => $item) { $string = 'This is an iteration: ' . $item['message'] . ', pointer at ' . ($key + 1); - $this->assertContains($string, $result); + $this->assertStringContainsString($string, $result); } } @@ -364,7 +366,7 @@ public function testPartialLoopSetsTotalCount() $result = $this->helper->partialLoop('partialLoopCouter.phtml', $data); foreach ($data as $key => $item) { $string = 'Total count: ' . count($data); - $this->assertContains($string, $result); + $this->assertStringContainsString($string, $result); } } } diff --git a/tests/Zend/View/Helper/PartialTest.php b/tests/Zend/View/Helper/PartialTest.php index c690626f..838956ce 100644 --- a/tests/Zend/View/Helper/PartialTest.php +++ b/tests/Zend/View/Helper/PartialTest.php @@ -81,7 +81,7 @@ public function testPartialRendersScript() )); $this->helper->setView($view); $return = $this->helper->partial('partialOne.phtml'); - $this->assertContains('This is the first test partial', $return); + $this->assertStringContainsString('This is the first test partial', $return); } public function testPartialRendersScriptWithVars() @@ -92,8 +92,8 @@ public function testPartialRendersScriptWithVars() $view->message = 'This should never be read'; $this->helper->setView($view); $return = $this->helper->partial('partialThree.phtml', array('message' => 'This message should be read')); - $this->assertNotContains($view->message, $return); - $this->assertContains('This message should be read', $return, $return); + $this->assertStringNotContainsString($view->message, $return); + $this->assertStringContainsString('This message should be read', $return, $return); } public function testPartialRendersScriptInDifferentModuleWhenRequested() @@ -104,7 +104,7 @@ public function testPartialRendersScriptInDifferentModuleWhenRequested() )); $this->helper->setView($view); $return = $this->helper->partial('partialTwo.phtml', 'foo'); - $this->assertContains('This is the second partial', $return, $return); + $this->assertStringContainsString('This is the second partial', $return, $return); } public function testPartialThrowsExceptionWithInvalidModule() @@ -120,6 +120,7 @@ public function testPartialThrowsExceptionWithInvalidModule() $this->fail('Partial should throw exception if module does not exist'); } catch (Exception $e) { } + self::assertTrue(true); } public function testSetViewSetsViewProperty() @@ -165,7 +166,7 @@ public function testObjectModelWithPublicPropertiesSetsViewVariables() foreach (get_object_vars($model) as $key => $value) { $string = sprintf('%s: %s', $key, $value); - $this->assertContains($string, $return); + $this->assertStringContainsString($string, $return); } } @@ -181,7 +182,7 @@ public function testObjectModelWithToArraySetsViewVariables() foreach ($model->toArray() as $key => $value) { $string = sprintf('%s: %s', $key, $value); - $this->assertContains($string, $return); + $this->assertStringContainsString($string, $return); } } @@ -198,11 +199,11 @@ public function testObjectModelSetInObjectKeyWhenKeyPresent() $this->helper->setView($view); $return = $this->helper->partial('partialObj.phtml', $model); - $this->assertNotContains('No object model passed', $return); + $this->assertStringNotContainsString('No object model passed', $return); foreach (get_object_vars($model) as $key => $value) { $string = sprintf('%s: %s', $key, $value); - $this->assertContains($string, $return, "Checking for '$return' containing '$string'"); + $this->assertStringContainsString($string, $return, "Checking for '$return' containing '$string'"); } } diff --git a/tests/Zend/View/Helper/Placeholder/ContainerTest.php b/tests/Zend/View/Helper/Placeholder/ContainerTest.php index 5c0a0aa1..d041ee19 100644 --- a/tests/Zend/View/Helper/Placeholder/ContainerTest.php +++ b/tests/Zend/View/Helper/Placeholder/ContainerTest.php @@ -223,7 +223,7 @@ public function testCapturingToPlaceholderKeyUsingSetReplacesContentAtKey() $this->assertEquals(1, count($this->container)); $this->assertTrue(isset($this->container['key'])); $value = $this->container['key']; - $this->assertContains('This is content intended for capture', $value); + $this->assertStringContainsString('This is content intended for capture', $value); } public function testCapturingToPlaceholderKeyUsingAppendAppendsContentAtKey() @@ -236,7 +236,7 @@ public function testCapturingToPlaceholderKeyUsingAppendAppendsContentAtKey() $this->assertEquals(1, count($this->container)); $this->assertTrue(isset($this->container['key'])); $value = $this->container['key']; - $this->assertContains('Foobar This is content intended for capture', $value); + $this->assertStringContainsString('Foobar This is content intended for capture', $value); } public function testNestedCapturesThrowsException() diff --git a/tests/Zend/View/Helper/Placeholder/RegistryTest.php b/tests/Zend/View/Helper/Placeholder/RegistryTest.php index 312dd0a1..a6c95a55 100644 --- a/tests/Zend/View/Helper/Placeholder/RegistryTest.php +++ b/tests/Zend/View/Helper/Placeholder/RegistryTest.php @@ -118,6 +118,7 @@ public function testSetContainerClassThrowsExceptionWithInvalidContainerClass() $this->fail('Invalid container classes should not be accepted'); } catch (Exception $e) { } + self::assertTrue(true); } public function testDeletingContainerRemovesFromRegistry() diff --git a/tests/Zend/View/Helper/Placeholder/StandaloneContainerTest.php b/tests/Zend/View/Helper/Placeholder/StandaloneContainerTest.php index 2c0f1cb2..6ba6cc13 100644 --- a/tests/Zend/View/Helper/Placeholder/StandaloneContainerTest.php +++ b/tests/Zend/View/Helper/Placeholder/StandaloneContainerTest.php @@ -88,9 +88,9 @@ public function testContainersPersistBetweenInstances() $foo2->append('Bar'); $test = $foo1->toString(); - $this->assertContains('Foo', $test); - $this->assertContains(' - ', $test); - $this->assertContains('Bar', $test); + $this->assertStringContainsString('Foo', $test); + $this->assertStringContainsString(' - ', $test); + $this->assertStringContainsString('Bar', $test); } } diff --git a/tests/Zend/View/Helper/TranslateTest.php b/tests/Zend/View/Helper/TranslateTest.php index 93576709..fa62c1bf 100644 --- a/tests/Zend/View/Helper/TranslateTest.php +++ b/tests/Zend/View/Helper/TranslateTest.php @@ -120,7 +120,7 @@ public function testPassingNonNullNonTranslationObjectToConstructorThrowsExcepti try { $helper = new Zend_View_Helper_Translate('something'); } catch (Zend_View_Exception $e) { - $this->assertContains('must set an instance of Zend_Translate', $e->getMessage()); + $this->assertStringContainsString('must set an instance of Zend_Translate', $e->getMessage()); } } @@ -129,7 +129,7 @@ public function testPassingNonTranslationObjectToSetTranslatorThrowsException() try { $this->helper->setTranslator('something'); } catch (Zend_View_Exception $e) { - $this->assertContains('must set an instance of Zend_Translate', $e->getMessage()); + $this->assertStringContainsString('must set an instance of Zend_Translate', $e->getMessage()); } } @@ -138,7 +138,7 @@ public function testRetrievingLocaleWhenNoTranslationObjectSetThrowsException() try { $this->helper->getLocale(); } catch (Zend_View_Exception $e) { - $this->assertContains('must set an instance of Zend_Translate', $e->getMessage()); + $this->assertStringContainsString('must set an instance of Zend_Translate', $e->getMessage()); } } @@ -147,7 +147,7 @@ public function testSettingLocaleWhenNoTranslationObjectSetThrowsException() try { $this->helper->setLocale('de'); } catch (Zend_View_Exception $e) { - $this->assertContains('must set an instance of Zend_Translate', $e->getMessage()); + $this->assertStringContainsString('must set an instance of Zend_Translate', $e->getMessage()); } } diff --git a/tests/Zend/ViewTest.php b/tests/Zend/ViewTest.php index a7097cd6..7123d7fc 100644 --- a/tests/Zend/ViewTest.php +++ b/tests/Zend/ViewTest.php @@ -252,7 +252,7 @@ public function testLoadHelperNonexistantFile() $view->nonexistantHelper(); // @todo fail if no exception? } catch (Zend_Exception $e) { - $this->assertContains('not found', $e->getMessage()); + $this->assertStringContainsString('not found', $e->getMessage()); } } @@ -272,7 +272,7 @@ public function testLoadHelperNonexistantClass() $view->stubEmpty(); // @todo fail if no exception? } catch (Zend_Exception $e) { - $this->assertContains('not found', $e->getMessage()); + $this->assertStringContainsString('not found', $e->getMessage()); } } @@ -381,8 +381,7 @@ public function testNoPath() $view->render('somefootemplate.phtml'); $this->fail('Rendering a template when no script path is set should raise an exception'); } catch (Exception $e) { - // success... - // @todo assert something? + self::assertTrue(true); } } @@ -517,7 +516,7 @@ public function testUnset() { $view = new Zend_View(); unset($view->_path); - // @todo assert something? + self::assertTrue(true); } public function testSetProtectedThrowsException() @@ -528,8 +527,7 @@ public function testSetProtectedThrowsException() $view->_path = 'bar'; $this->fail('Should not be able to set protected properties'); } catch (Exception $e) { - // success - // @todo assert something? + self::assertTrue(true); } } @@ -602,6 +600,7 @@ public function testAssignThrowsExceptionsOnBadValues() // success // @todo assert something? } + self::assertTrue(true); } public function testEscape() @@ -840,7 +839,7 @@ public function testGetHelperPath() $view = new Zend_View(); $view->declareVars(); $helperPath = $view->getHelperPath('declareVars'); - $this->assertContains($expected, $helperPath); + $this->assertStringContainsString($expected, $helperPath); } public function testGetFilter() @@ -893,7 +892,7 @@ public function testMissingViewScriptExceptionText() $view->render('bazbatNotExists.php.tpl'); $this->fail('Non-existent view script should cause an exception'); } catch (Exception $e) { - $this->assertContains($base . '_templates', $e->getMessage()); + $this->assertStringContainsString($base . '_templates', $e->getMessage()); } } @@ -901,7 +900,7 @@ public function testGetHelperIsCaseInsensitive() { $view = new Zend_View(); $hidden = $view->formHidden('foo', 'bar'); - $this->assertContains('<input type="hidden"', $hidden); + $this->assertStringContainsString('<input type="hidden"', $hidden); $hidden = $view->getHelper('formHidden')->formHidden('foo', 'bar'); $this->assertContains('<input type="hidden"', $hidden); @@ -932,20 +931,20 @@ public function testGetHelperWorksWithPredefinedClassNames() $view->setHelperPath(__DIR__ . '/View/_stubs/HelperDir1', null); $this->fail('Exception for empty prefix was expected.'); } catch (Exception $e) { - $this->assertContains('only takes strings', $e->getMessage()); + $this->assertStringContainsString('only takes strings', $e->getMessage()); } try { $view->setHelperPath(__DIR__ . '/View/_stubs/HelperDir1', null); $this->fail('Exception for empty prefix was expected.'); } catch (Exception $e) { - $this->assertContains('only takes strings', $e->getMessage()); + $this->assertStringContainsString('only takes strings', $e->getMessage()); } try { $helper = $view->getHelper('Datetime'); } catch (Exception $e) { - $this->assertContains('not found', $e->getMessage()); + $this->assertStringContainsString('not found', $e->getMessage()); } } @@ -975,21 +974,21 @@ public function testRenderShouldNotAllowScriptPathsContainingParentDirectoryTrav $view->render('../foobar.html'); $this->fail('Should not allow parent directory traversal'); } catch (Zend_View_Exception $e) { - $this->assertContains('parent directory traversal', $e->getMessage()); + $this->assertStringContainsString('parent directory traversal', $e->getMessage()); } try { $view->render('foo/../foobar.html'); $this->fail('Should not allow parent directory traversal'); } catch (Zend_View_Exception $e) { - $this->assertContains('parent directory traversal', $e->getMessage()); + $this->assertStringContainsString('parent directory traversal', $e->getMessage()); } try { $view->render('foo/..\foobar.html'); $this->fail('Should not allow parent directory traversal'); } catch (Zend_View_Exception $e) { - $this->assertContains('parent directory traversal', $e->getMessage()); + $this->assertStringContainsString('parent directory traversal', $e->getMessage()); } } @@ -1033,7 +1032,7 @@ public function testDisablingLfiProtectionAllowsParentDirectoryTraversal() try { $test = $view->render('../_stubs/scripts/LfiProtectionCheck.phtml'); - $this->assertContains('LFI', $test); + $this->assertStringContainsString('LFI', $test); } catch (Zend_View_Exception $e) { $this->fail('LFI attack failed: ' . $e->getMessage()); } @@ -1084,20 +1083,20 @@ public function testRegisterHelperShouldRegisterHelperWithView() /** * @group ZF-8177 - * @expectedException Zend_View_Exception */ public function testRegisterHelperShouldThrowExceptionIfNotProvidedAnObject() { + $this->expectException(\Zend_View_Exception::class); $view = new Zend_View(); $view->registerHelper('Foo', 'foo'); } /** * @group ZF-8177 - * @expectedException Zend_View_Exception */ public function testRegisterHelperShouldThrowExceptionIfProvidedANonHelperObject() { + $this->expectException(\Zend_View_Exception::class); $view = new Zend_View(); $helper = new stdClass(); $view->registerHelper($helper, 'foo'); diff --git a/tests/Zend/Xml/SecurityTest.php b/tests/Zend/Xml/SecurityTest.php index fda63b3f..daddee6b 100644 --- a/tests/Zend/Xml/SecurityTest.php +++ b/tests/Zend/Xml/SecurityTest.php @@ -69,6 +69,7 @@ public function testScanForXXE() $result = Zend_Xml_Security::scan($xml); } catch (Zend_Xml_Exception $e) { unlink($file); + self::assertTrue(true); return; } diff --git a/tests/ZendX/JQuery/Form/DecoratorTest.php b/tests/ZendX/JQuery/Form/DecoratorTest.php index 02aa8546..8494d7a7 100644 --- a/tests/ZendX/JQuery/Form/DecoratorTest.php +++ b/tests/ZendX/JQuery/Form/DecoratorTest.php @@ -71,7 +71,7 @@ public function testUiWidgetElementDecoratorRender() $ac->setView($view); $output = $ac->render(); - $this->assertContains('ac1', $output); + $this->assertStringContainsString('ac1', $output); } public function testUiWidgetElementJQueryParams() @@ -141,6 +141,7 @@ public function testUiWidgetPaneRenderingThrowsExceptionWithoutContainerIdOption $this->fail(); } catch (Zend_Form_Decorator_Exception $e) { } + self::assertTrue(true); } public function testUiWidgetPaneRenderingThrowsExceptionWithoutTitleOption() @@ -212,9 +213,9 @@ public function testUiWidgetContainerRender() $form->addSubForm($subForm1, 'form1'); $output = $form->render($view); - $this->assertContains('id="tabContainer"', $output); - $this->assertContains('href="#tabContainer-frag-1"', $output); - $this->assertContains('id="tabContainer-frag-1"', $output); + $this->assertStringContainsString('id="tabContainer"', $output); + $this->assertStringContainsString('href="#tabContainer-frag-1"', $output); + $this->assertStringContainsString('id="tabContainer-frag-1"', $output); } /** @@ -356,7 +357,7 @@ public function testUiWidgetDialogContainerRenderBug() $output = $form->render($view); - $this->assertContains('<div id="tabContainer" style="width: 600px;"><form', $output); + $this->assertStringContainsString('<div id="tabContainer" style="width: 600px;"><form', $output); } public function testRenderWidgetElementShouldEnableJQueryHelper() @@ -384,10 +385,10 @@ public function testSettingWidgetPlacement() $widget->getDecorator('UiWidgetElement')->setOption('placement', 'APPEND'); $html = $widget->render(); - $this->assertContains('[SEP]<input type="text" name="spinner1" id="spinner1" value="">', $html); + $this->assertStringContainsString('[SEP]<input type="text" name="spinner1" id="spinner1" value="">', $html); $widget->getDecorator('UiWidgetElement')->setOption('placement', 'PREPEND'); $html = $widget->render(); - $this->assertContains('<input type="text" name="spinner1" id="spinner1" value="">[SEP]', $html); + $this->assertStringContainsString('<input type="text" name="spinner1" id="spinner1" value="">[SEP]', $html); } } diff --git a/tests/ZendX/JQuery/Form/ElementTest.php b/tests/ZendX/JQuery/Form/ElementTest.php index 99ea5a33..63322c8f 100644 --- a/tests/ZendX/JQuery/Form/ElementTest.php +++ b/tests/ZendX/JQuery/Form/ElementTest.php @@ -110,6 +110,7 @@ public function testJQueryElementWithOnlyViewHelperIsNotAllowedToDieZf4694() } catch (Exception $e) { $this->fail(); } + self::assertTrue(true); } /** @@ -138,6 +139,7 @@ public function testJQueryElementHasToImplementMarkerInterface() } catch (ZendX_JQuery_Form_Exception $e) { $this->fail(); } + self::assertTrue(true); } /** @@ -188,8 +190,8 @@ public function testFormWithoutIdButSubformsProducesArrayNotationWhichWontWork() $form = $form->render($view); $jquery = $view->jQuery()->__toString(); - $this->assertContains('sf1[dp1]', $form); - $this->assertNotContains('$("#sf1[dp1]")', $jquery); + $this->assertStringContainsString('sf1[dp1]', $form); + $this->assertStringNotContainsString('$("#sf1[dp1]")', $jquery); } /** @@ -205,7 +207,7 @@ public function testDatePickerWithDescriptionDecorator() $html = $datePicker->render($view); - $this->assertContains('<p class="description">foo</p>', $html); + $this->assertStringContainsString('<p class="description">foo</p>', $html); } public function testGetDefaultDecorators() diff --git a/tests/ZendX/JQuery/View/AutoCompleteTest.php b/tests/ZendX/JQuery/View/AutoCompleteTest.php index 2728d443..de72b03e 100644 --- a/tests/ZendX/JQuery/View/AutoCompleteTest.php +++ b/tests/ZendX/JQuery/View/AutoCompleteTest.php @@ -35,15 +35,13 @@ public function testShouldAppendToJqueryHelper() $element = $this->view->autoComplete('elem1', 'Default', array('option' => 'true', 'data' => array('test')), array()); $jquery = $this->view->jQuery()->__toString(); - $this->assertContains('autocomplete(', $jquery); - $this->assertContains('"option":"true"', $jquery); + $this->assertStringContainsString('autocomplete(', $jquery); + $this->assertStringContainsString('"option":"true"', $jquery); } - /** - * @expectedException ZendX_JQuery_Exception - */ public function testShouldAllowAutoCompleteOnlyWithSourceOption() { + $this->expectException(\ZendX_JQuery_Exception::class); $element = $this->view->autoComplete('elem1'); } @@ -52,8 +50,8 @@ public function testShouldCreateInputField() $element = $this->view->autoComplete('elem1', 'Default', array('source' => array('Test'))); $this->assertEquals(array('$("#elem1").autocomplete({"source":["Test"]});'), $this->view->jQuery()->getOnLoadActions()); - $this->assertContains('<input', $element); - $this->assertContains('id="elem1"', $element); - $this->assertContains('value="Default"', $element); + $this->assertStringContainsString('<input', $element); + $this->assertStringContainsString('id="elem1"', $element); + $this->assertStringContainsString('value="Default"', $element); } } diff --git a/tests/ZendX/JQuery/View/DialogContainerTest.php b/tests/ZendX/JQuery/View/DialogContainerTest.php index 98add424..465313db 100644 --- a/tests/ZendX/JQuery/View/DialogContainerTest.php +++ b/tests/ZendX/JQuery/View/DialogContainerTest.php @@ -34,8 +34,8 @@ public function testShouldAppendToJqueryHelper() $element = $this->view->dialogContainer('elem1', '', array('option' => 'true')); $jquery = $this->jquery->__toString(); - $this->assertContains('dialog(', $jquery); - $this->assertContains('"option":"true"', $jquery); + $this->assertStringContainsString('dialog(', $jquery); + $this->assertStringContainsString('"option":"true"', $jquery); } public function testShouldCreateDivContainer() @@ -43,9 +43,9 @@ public function testShouldCreateDivContainer() $element = $this->view->dialogContainer('elem1', '', array(), array()); $this->assertEquals(array('$("#elem1").dialog({});'), $this->jquery->getOnLoadActions()); - $this->assertContains('<div', $element); - $this->assertContains('id="elem1"', $element); - $this->assertContains('</div>', $element); + $this->assertStringContainsString('<div', $element); + $this->assertStringContainsString('id="elem1"', $element); + $this->assertStringContainsString('</div>', $element); } /** diff --git a/tests/ZendX/JQuery/View/TabContainerTest.php b/tests/ZendX/JQuery/View/TabContainerTest.php index eba02e9c..f7da1ee5 100644 --- a/tests/ZendX/JQuery/View/TabContainerTest.php +++ b/tests/ZendX/JQuery/View/TabContainerTest.php @@ -35,8 +35,8 @@ public function testShouldAppendToJqueryHelper() $element = $this->view->tabContainer('elem1', array('option' => 'true'), array()); $jquery = $this->view->jQuery()->__toString(); - $this->assertContains('tabs(', $jquery); - $this->assertContains('"option":"true"', $jquery); + $this->assertStringContainsString('tabs(', $jquery); + $this->assertStringContainsString('"option":"true"', $jquery); } public function testShouldAllowAddingTabs() @@ -46,12 +46,12 @@ public function testShouldAllowAddingTabs() ->tabContainer('container1', array(), array()); $this->assertEquals(array('$("#container1").tabs({});'), $this->jquery->getOnLoadActions()); - $this->assertContains('elem1', $tabs); - $this->assertContains('Text1', $tabs); - $this->assertContains('elem2', $tabs); - $this->assertContains('Text2', $tabs); - $this->assertContains('href="#container1-frag-1"', $tabs); - $this->assertContains('href="#container1-frag-2"', $tabs); + $this->assertStringContainsString('elem1', $tabs); + $this->assertStringContainsString('Text1', $tabs); + $this->assertStringContainsString('elem2', $tabs); + $this->assertStringContainsString('Text2', $tabs); + $this->assertStringContainsString('href="#container1-frag-1"', $tabs); + $this->assertStringContainsString('href="#container1-frag-2"', $tabs); } public function testShoudAllowAddingTabsFromUrls() @@ -61,10 +61,10 @@ public function testShoudAllowAddingTabsFromUrls() ->tabContainer('container1', array(), array()); $this->assertEquals(array('$("#container1").tabs({});'), $this->jquery->getOnLoadActions()); - $this->assertContains('elem1', $tabs); - $this->assertContains('elem2', $tabs); - $this->assertContains('href="blub.html"', $tabs); - $this->assertContains('href="cookie.html"', $tabs); + $this->assertStringContainsString('elem1', $tabs); + $this->assertStringContainsString('elem2', $tabs); + $this->assertStringContainsString('href="blub.html"', $tabs); + $this->assertStringContainsString('href="cookie.html"', $tabs); } public function testShouldAllowCaptureTabContent() @@ -80,10 +80,10 @@ public function testShouldAllowCaptureTabContent() $tabs = $this->view->tabContainer('container1', array(), array()); $this->assertEquals(array('$("#container1").tabs({});'), $this->jquery->getOnLoadActions()); - $this->assertContains('elem1', $tabs); - $this->assertContains('elem2', $tabs); - $this->assertContains('Lorem Ipsum!', $tabs); - $this->assertContains('href="foo.html"', $tabs); + $this->assertStringContainsString('elem1', $tabs); + $this->assertStringContainsString('elem2', $tabs); + $this->assertStringContainsString('Lorem Ipsum!', $tabs); + $this->assertStringContainsString('href="foo.html"', $tabs); $this->assertNotContains('This is captured, but not displayed: contentUrl overrides this output.', $tabs); } @@ -95,10 +95,10 @@ public function testShouldAllowUsingTabPane() $tabs = $this->view->tabContainer('container1', array(), array()); $this->assertEquals(array('$("#container1").tabs({});'), $this->jquery->getOnLoadActions()); - $this->assertContains('elem1', $tabs); - $this->assertContains('elem2', $tabs); - $this->assertContains('Lorem Ipsum!', $tabs); - $this->assertContains('href="foo.html"', $tabs); + $this->assertStringContainsString('elem1', $tabs); + $this->assertStringContainsString('elem2', $tabs); + $this->assertStringContainsString('Lorem Ipsum!', $tabs); + $this->assertStringContainsString('href="foo.html"', $tabs); $this->assertNotContains('This is captured, but not displayed: contentUrl overrides this output.', $tabs); } @@ -120,5 +120,6 @@ public function testPaneCaptureLockExceptionNoEndWithoutStartPossible() $this->fail(); } catch (ZendX_JQuery_View_Exception $e) { } + self::assertTrue(true); } } diff --git a/tests/ZendX/JQuery/View/jQueryTest.php b/tests/ZendX/JQuery/View/jQueryTest.php index 8805e1fa..5db0f019 100644 --- a/tests/ZendX/JQuery/View/jQueryTest.php +++ b/tests/ZendX/JQuery/View/jQueryTest.php @@ -24,13 +24,12 @@ public function testHelperSuccessfulCallForward() { $jquery = new ZendX_JQuery_View_Helper_JQuery(); $jquery->addJavascript('alert();'); + self::assertTrue(true); } - /** - * @expectedException Zend_View_Exception - */ public function testHelperFailingCallForward() { + $this->expectException(\Zend_View_Exception::class); $jquery = new ZendX_JQuery_View_Helper_JQuery(); $jquery->addAsdf(); } @@ -75,10 +74,10 @@ public function testUsingLocalPath() $this->assertFalse($this->jquery->useCDN()); $this->assertFalse($this->jquery->isEnabled()); $this->assertTrue($this->jquery->useLocalPath()); - $this->assertContains('/js/jquery.min.js', $this->jquery->getLocalPath()); + $this->assertStringContainsString('/js/jquery.min.js', $this->jquery->getLocalPath()); $render = $this->jquery->__toString(); - $this->assertNotContains('/js/jquery.min.js', $render); + $this->assertStringNotContainsString('/js/jquery.min.js', $render); } public function testUiDisabledDefault() @@ -104,14 +103,14 @@ public function testShouldAllowEnableUi() $this->jquery->uiEnable(); $render = $this->jquery->__toString(); - $this->assertContains('jquery-ui', $render); - $this->assertContains($this->jquery->getUiVersion(), $render); + $this->assertStringContainsString('jquery-ui', $render); + $this->assertStringContainsString($this->jquery->getUiVersion(), $render); } public function testShouldAllowSetUiVersion() { $this->jquery->setUiVersion('1.5.1'); - $this->assertContains('1.5.1', $this->jquery->getUiVersion()); + $this->assertStringContainsString('1.5.1', $this->jquery->getUiVersion()); } public function testShouldAllowSetLocalUiPath() @@ -120,7 +119,7 @@ public function testShouldAllowSetLocalUiPath() $this->assertTrue($this->jquery->useUiLocal()); $this->assertFalse($this->jquery->useUiCdn()); - $this->assertContains('/js/jquery-ui.min.js', $this->jquery->getUiPath()); + $this->assertStringContainsString('/js/jquery-ui.min.js', $this->jquery->getUiPath()); } public function testNoConflictShouldBeDisabledDefault() @@ -135,7 +134,7 @@ public function testUsingNoConflictMode() $this->jquery->enable(); $render = $this->jquery->__toString(); - $this->assertContains('var $j = jQuery.noConflict();', $render); + $this->assertStringContainsString('var $j = jQuery.noConflict();', $render); } public function testDefaultRenderModeShouldIncludeAllBlocks() @@ -192,20 +191,16 @@ public function testShouldAllowCaptureJavascript() $this->assertEquals(array(), $this->jquery->getJavascript()); } - /** - * @expectedException Zend_Exception - */ public function testShouldDisallowNestingCapturesWithException() { + $this->expectException(\Zend_Exception::class); $this->jquery->javascriptCaptureStart(); $this->jquery->javascriptCaptureStart(); } - /** - * @expectedException Zend_Exception - */ public function testShouldDisallowNestingCapturesWithException2() { + $this->expectException(\Zend_Exception::class); $this->jquery->onLoadCaptureStart(); $this->jquery->onLoadCaptureStart(); @@ -240,9 +235,9 @@ public function testAddedJavascriptFilesRender() $this->jquery->enable(); $render = $this->jquery->__toString(); - $this->assertContains('src="/js/test.js"', $render); - $this->assertContains('src="/js/test2.js"', $render); - $this->assertContains('src="http://example.com/test3.js', $render); + $this->assertStringContainsString('src="/js/test.js"', $render); + $this->assertStringContainsString('src="/js/test2.js"', $render); + $this->assertStringContainsString('src="http://example.com/test3.js', $render); } public function testAddStylesheet() @@ -270,10 +265,10 @@ public function testShouldAllowBasicSetupWithCDN() $render = $this->jquery->__toString(); $this->assertTrue($this->jquery->useCDN()); - $this->assertContains('jquery.min.js', $render); - $this->assertContains('1.2.3', $render); - $this->assertContains('test.js', $render); - $this->assertContains('<script type="text/javascript"', $render); + $this->assertStringContainsString('jquery.min.js', $render); + $this->assertStringContainsString('1.2.3', $render); + $this->assertStringContainsString('test.js', $render); + $this->assertStringContainsString('<script type="text/javascript"', $render); } public function testShouldAllowUseRenderMode() @@ -295,56 +290,56 @@ public function testShouldAllowUseRenderMode() // Test Render Only Library $this->jquery->setRenderMode(ZendX_JQuery::RENDER_LIBRARY); $render = $this->jquery->__toString(); - $this->assertContains('1.2.3/jquery.min.js', $render); - $this->assertNotContains('test.css', $render); - $this->assertNotContains('test.js', $render); - $this->assertNotContains('alert();', $render); - $this->assertNotContains('helloWorld();', $render); + $this->assertStringContainsString('1.2.3/jquery.min.js', $render); + $this->assertStringNotContainsString('test.css', $render); + $this->assertStringNotContainsString('test.js', $render); + $this->assertStringNotContainsString('alert();', $render); + $this->assertStringNotContainsString('helloWorld();', $render); // Test Render Only AddOnLoad $this->jquery->setRenderMode(ZendX_JQuery::RENDER_JQUERY_ON_LOAD); $render = $this->jquery->__toString(); - $this->assertNotContains('1.2.3/jquery.min.js', $render); - $this->assertNotContains('test.css', $render); - $this->assertNotContains('test.js', $render); - $this->assertContains('alert();', $render); - $this->assertNotContains('helloWorld();', $render); + $this->assertStringNotContainsString('1.2.3/jquery.min.js', $render); + $this->assertStringNotContainsString('test.css', $render); + $this->assertStringNotContainsString('test.js', $render); + $this->assertStringContainsString('alert();', $render); + $this->assertStringNotContainsString('helloWorld();', $render); // Test Render Only Javascript $this->jquery->setRenderMode(ZendX_JQuery::RENDER_SOURCES); $render = $this->jquery->__toString(); - $this->assertNotContains('1.2.3/jquery.min.js', $render); - $this->assertNotContains('test.css', $render); - $this->assertContains('test.js', $render); - $this->assertNotContains('alert();', $render); - $this->assertNotContains('helloWorld();', $render); + $this->assertStringNotContainsString('1.2.3/jquery.min.js', $render); + $this->assertStringNotContainsString('test.css', $render); + $this->assertStringContainsString('test.js', $render); + $this->assertStringNotContainsString('alert();', $render); + $this->assertStringNotContainsString('helloWorld();', $render); // Test Render Only Javascript $this->jquery->setRenderMode(ZendX_JQuery::RENDER_STYLESHEETS); $render = $this->jquery->__toString(); - $this->assertNotContains('1.2.3/jquery.min.js', $render); - $this->assertContains('test.css', $render); - $this->assertNotContains('test.js', $render); - $this->assertNotContains('alert();', $render); - $this->assertNotContains('helloWorld();', $render); + $this->assertStringNotContainsString('1.2.3/jquery.min.js', $render); + $this->assertStringContainsString('test.css', $render); + $this->assertStringNotContainsString('test.js', $render); + $this->assertStringNotContainsString('alert();', $render); + $this->assertStringNotContainsString('helloWorld();', $render); // Test Render Library and AddOnLoad $this->jquery->setRenderMode(ZendX_JQuery::RENDER_LIBRARY | ZendX_JQuery::RENDER_JQUERY_ON_LOAD); $render = $this->jquery->__toString(); - $this->assertContains('1.2.3/jquery.min.js', $render); - $this->assertNotContains('test.css', $render); - $this->assertNotContains('test.js', $render); - $this->assertContains('alert();', $render); - $this->assertNotContains('helloWorld();', $render); + $this->assertStringContainsString('1.2.3/jquery.min.js', $render); + $this->assertStringNotContainsString('test.css', $render); + $this->assertStringNotContainsString('test.js', $render); + $this->assertStringContainsString('alert();', $render); + $this->assertStringNotContainsString('helloWorld();', $render); // Test Render All $this->jquery->setRenderMode(ZendX_JQuery::RENDER_ALL); $render = $this->jquery->__toString(); - $this->assertContains('1.2.3/jquery.min.js', $render); - $this->assertContains('test.css', $render); - $this->assertContains('test.js', $render); - $this->assertContains('alert();', $render); - $this->assertContains('helloWorld();', $render); + $this->assertStringContainsString('1.2.3/jquery.min.js', $render); + $this->assertStringContainsString('test.css', $render); + $this->assertStringContainsString('test.js', $render); + $this->assertStringContainsString('alert();', $render); + $this->assertStringContainsString('helloWorld();', $render); } /** @@ -373,12 +368,12 @@ public function testNoConflictModeIsRecognizedInRenderingOnLoadStackEvent() $this->jquery->enable(); $jQueryStack = $this->jquery->__toString(); - $this->assertContains('$j(document).ready(function()', $jQueryStack); + $this->assertStringContainsString('$j(document).ready(function()', $jQueryStack); ZendX_JQuery_View_Helper_JQuery::disableNoConflictMode(); $jQueryStack = $this->jquery->__toString(); - $this->assertNotContains('$j(document).ready(function()', $jQueryStack); + $this->assertStringNotContainsString('$j(document).ready(function()', $jQueryStack); } /** @@ -391,7 +386,7 @@ public function testStylesheetShouldRenderCorrectClosingBracketBasedOnHtmlDoctyp $assert = '<link rel="stylesheet" href="test.css" type="text/css" media="screen">'; $this->jquery->enable(); - $this->assertContains($assert, $this->jquery->__toString()); + $this->assertStringContainsString($assert, $this->jquery->__toString()); } /** @@ -404,7 +399,7 @@ public function testStylesheetShouldRenderCorrectClosingBracketBasedOnXHtmlDocty $assert = '<link rel="stylesheet" href="test.css" type="text/css" media="screen" />'; $this->jquery->enable(); - $this->assertContains($assert, $this->jquery->__toString()); + $this->assertStringContainsString($assert, $this->jquery->__toString()); } /** @@ -428,7 +423,7 @@ public function testIncludeJQueryLibraryFromSslPath() $this->jquery->setCdnSsl(true); $this->jquery->enable(); - $this->assertContains(ZendX_JQuery::CDN_BASE_GOOGLE_SSL, $this->jquery->__toString()); + $this->assertStringContainsString(ZendX_JQuery::CDN_BASE_GOOGLE_SSL, $this->jquery->__toString()); } /** @@ -440,7 +435,7 @@ public function testJQueryGoogleCdnPathIsBuiltCorrectly() $this->jquery->setVersion('1.3.1'); $this->jquery->enable(); - $this->assertContains($jQueryCdnPath, $this->jquery->__toString()); + $this->assertStringContainsString($jQueryCdnPath, $this->jquery->__toString()); } /** @@ -454,7 +449,7 @@ public function testJQueryUiGoogleCdnPathIsBuiltCorrectly() $this->jquery->setUiVersion('1.7.1'); $this->jquery->uiEnable(); - $this->assertContains($jQueryCdnPath, $this->jquery->__toString()); + $this->assertStringContainsString($jQueryCdnPath, $this->jquery->__toString()); } /** @@ -467,7 +462,7 @@ public function testJQueryGoogleCdnSslPathIsBuiltCorrectly() $this->jquery->setVersion('1.3.1'); $this->jquery->enable(); - $this->assertContains($jQueryCdnPath, $this->jquery->__toString()); + $this->assertStringContainsString($jQueryCdnPath, $this->jquery->__toString()); } /** @@ -482,6 +477,6 @@ public function testJQueryUiGoogleCdnSslPathIsBuiltCorrectly() $this->jquery->setUiVersion('1.7.1'); $this->jquery->uiEnable(); - $this->assertContains($jQueryCdnPath, $this->jquery->__toString()); + $this->assertStringContainsString($jQueryCdnPath, $this->jquery->__toString()); } }