Skip to content

Commit 0c49028

Browse files
committed
Less warnings
1 parent 2b18b6e commit 0c49028

File tree

186 files changed

+1268
-2545
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+1268
-2545
lines changed

tests/Zend/Acl/AclTest.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function testRoleRegistryRemoveOneNonExistent()
8888
$this->_acl->removeRole('nonexistent');
8989
$this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon removing a non-existent Role');
9090
} catch (Zend_Acl_Role_Registry_Exception $e) {
91-
$this->assertContains('not found', $e->getMessage());
91+
$this->assertStringContainsString('not found', $e->getMessage());
9292
}
9393
}
9494

@@ -112,7 +112,7 @@ public function testRoleRegistryAddInheritsNonExistent()
112112
$this->_acl->addRole(new Zend_Acl_Role('guest'), 'nonexistent');
113113
$this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon specifying a non-existent parent');
114114
} catch (Zend_Acl_Role_Registry_Exception $e) {
115-
$this->assertContains('does not exist', $e->getMessage());
115+
$this->assertStringContainsString('does not exist', $e->getMessage());
116116
}
117117
}
118118

@@ -128,14 +128,14 @@ public function testRoleRegistryInheritsNonExistent()
128128
$this->_acl->inheritsRole('nonexistent', $roleGuest);
129129
$this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon specifying a non-existent child Role');
130130
} catch (Zend_Acl_Role_Registry_Exception $e) {
131-
$this->assertContains('not found', $e->getMessage());
131+
$this->assertStringContainsString('not found', $e->getMessage());
132132
}
133133

134134
try {
135135
$this->_acl->inheritsRole($roleGuest, 'nonexistent');
136136
$this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon specifying a non-existent parent Role');
137137
} catch (Zend_Acl_Role_Registry_Exception $e) {
138-
$this->assertContains('not found', $e->getMessage());
138+
$this->assertStringContainsString('not found', $e->getMessage());
139139
}
140140
}
141141

@@ -210,7 +210,7 @@ public function testRoleRegistryDuplicate()
210210
->add($roleGuest);
211211
$this->fail('Expected exception not thrown upon adding same Role twice');
212212
} catch (Zend_Acl_Role_Registry_Exception $e) {
213-
$this->assertContains('already exists', $e->getMessage());
213+
$this->assertStringContainsString('already exists', $e->getMessage());
214214
}
215215
}
216216

@@ -228,7 +228,7 @@ public function testRoleRegistryDuplicateId()
228228
->add($roleGuest2);
229229
$this->fail('Expected exception not thrown upon adding two Roles with same ID');
230230
} catch (Zend_Acl_Role_Registry_Exception $e) {
231-
$this->assertContains('already exists', $e->getMessage());
231+
$this->assertStringContainsString('already exists', $e->getMessage());
232232
}
233233
}
234234

@@ -291,7 +291,7 @@ public function testResourceRemoveOneNonExistent()
291291
$this->_acl->remove('nonexistent');
292292
$this->fail('Expected Zend_Acl_Exception not thrown upon removing a non-existent Resource');
293293
} catch (Zend_Acl_Exception $e) {
294-
$this->assertContains('not found', $e->getMessage());
294+
$this->assertStringContainsString('not found', $e->getMessage());
295295
}
296296
}
297297

@@ -315,7 +315,7 @@ public function testResourceAddInheritsNonExistent()
315315
$this->_acl->add(new Zend_Acl_Resource('area'), 'nonexistent');
316316
$this->fail('Expected Zend_Acl_Exception not thrown upon specifying a non-existent parent');
317317
} catch (Zend_Acl_Exception $e) {
318-
$this->assertContains('does not exist', $e->getMessage());
318+
$this->assertStringContainsString('does not exist', $e->getMessage());
319319
}
320320
}
321321

@@ -331,14 +331,14 @@ public function testResourceInheritsNonExistent()
331331
$this->_acl->inherits('nonexistent', $resourceArea);
332332
$this->fail('Expected Zend_Acl_Exception not thrown upon specifying a non-existent child Resource');
333333
} catch (Zend_Acl_Exception $e) {
334-
$this->assertContains('not found', $e->getMessage());
334+
$this->assertStringContainsString('not found', $e->getMessage());
335335
}
336336

337337
try {
338338
$this->_acl->inherits($resourceArea, 'nonexistent');
339339
$this->fail('Expected Zend_Acl_Exception not thrown upon specifying a non-existent parent Resource');
340340
} catch (Zend_Acl_Exception $e) {
341-
$this->assertContains('not found', $e->getMessage());
341+
$this->assertStringContainsString('not found', $e->getMessage());
342342
}
343343
}
344344

@@ -374,7 +374,7 @@ public function testResourceDuplicate()
374374
->add($resourceArea);
375375
$this->fail('Expected exception not thrown upon adding same Resource twice');
376376
} catch (Zend_Acl_Exception $e) {
377-
$this->assertContains('already exists', $e->getMessage());
377+
$this->assertStringContainsString('already exists', $e->getMessage());
378378
}
379379
}
380380

@@ -390,7 +390,7 @@ public function testResourceDuplicateId()
390390
->add($resourceArea2);
391391
$this->fail('Expected exception not thrown upon adding two Resources with same ID');
392392
} catch (Zend_Acl_Exception $e) {
393-
$this->assertContains('already exists', $e->getMessage());
393+
$this->assertStringContainsString('already exists', $e->getMessage());
394394
}
395395
}
396396

@@ -403,14 +403,14 @@ public function testIsAllowedNonExistent()
403403
$this->_acl->isAllowed('nonexistent');
404404
$this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon non-existent Role');
405405
} catch (Zend_Acl_Role_Registry_Exception $e) {
406-
$this->assertContains('not found', $e->getMessage());
406+
$this->assertStringContainsString('not found', $e->getMessage());
407407
}
408408

409409
try {
410410
$this->_acl->isAllowed(null, 'nonexistent');
411411
$this->fail('Expected Zend_Acl_Exception not thrown upon non-existent Resource');
412412
} catch (Zend_Acl_Exception $e) {
413-
$this->assertContains('not found', $e->getMessage());
413+
$this->assertStringContainsString('not found', $e->getMessage());
414414
}
415415
}
416416

@@ -719,7 +719,7 @@ public function testRuleRoleRemove()
719719
$this->_acl->isAllowed('guest');
720720
$this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon isAllowed() on non-existent Role');
721721
} catch (Zend_Acl_Role_Registry_Exception $e) {
722-
$this->assertContains('not found', $e->getMessage());
722+
$this->assertStringContainsString('not found', $e->getMessage());
723723
}
724724
$this->_acl->addRole(new Zend_Acl_Role('guest'));
725725
$this->assertFalse($this->_acl->isAllowed('guest'));
@@ -739,7 +739,7 @@ public function testRuleRoleRemoveAll()
739739
$this->_acl->isAllowed('guest');
740740
$this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon isAllowed() on non-existent Role');
741741
} catch (Zend_Acl_Role_Registry_Exception $e) {
742-
$this->assertContains('not found', $e->getMessage());
742+
$this->assertStringContainsString('not found', $e->getMessage());
743743
}
744744
$this->_acl->addRole(new Zend_Acl_Role('guest'));
745745
$this->assertFalse($this->_acl->isAllowed('guest'));
@@ -759,7 +759,7 @@ public function testRulesResourceRemove()
759759
$this->_acl->isAllowed(null, 'area');
760760
$this->fail('Expected Zend_Acl_Exception not thrown upon isAllowed() on non-existent Resource');
761761
} catch (Zend_Acl_Exception $e) {
762-
$this->assertContains('not found', $e->getMessage());
762+
$this->assertStringContainsString('not found', $e->getMessage());
763763
}
764764
$this->_acl->add(new Zend_Acl_Resource('area'));
765765
$this->assertFalse($this->_acl->isAllowed(null, 'area'));
@@ -779,7 +779,7 @@ public function testRulesResourceRemoveAll()
779779
$this->_acl->isAllowed(null, 'area');
780780
$this->fail('Expected Zend_Acl_Exception not thrown upon isAllowed() on non-existent Resource');
781781
} catch (Zend_Acl_Exception $e) {
782-
$this->assertContains('not found', $e->getMessage());
782+
$this->assertStringContainsString('not found', $e->getMessage());
783783
}
784784
$this->_acl->add(new Zend_Acl_Resource('area'));
785785
$this->assertFalse($this->_acl->isAllowed(null, 'area'));
@@ -1076,11 +1076,11 @@ protected function _loadUseCase1()
10761076
/**
10771077
* Returns an array of registered roles.
10781078
*
1079-
* @expectedException \PHPUnit\Framework\Exception
10801079
* @group ZF-5638
10811080
*/
10821081
public function testGetRegisteredRoles()
10831082
{
1083+
$this->expectException(\PHPUnit\Framework\Exception::class);
10841084
$acl = $this->_acl;
10851085
$acl->addRole('developer');
10861086

@@ -1165,13 +1165,13 @@ public function testGetRegisteredRolesIsDeprecated()
11651165
try {
11661166
$this->_acl->getRegisteredRoles();
11671167
$this->fail('getRegisteredRoles() did not throw an exception');
1168-
} catch (\PHPUnit\Framework\Exception $e) {
1168+
} catch (\PHPUnit\Framework\Exception) {
11691169
self::assertTrue(true);
11701170

11711171
return;
11721172
}
11731173

1174-
$this->fail('An expected notice has not been raised');
1174+
static::fail('An expected notice has not been raised');
11751175
}
11761176

11771177
/**

tests/Zend/AllTests/StreamWrapper/PhpInput.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function stream_eof()
104104
return self::$_returnValues[__FUNCTION__];
105105
}
106106

107-
return 0 == strlen(self::$_data);
107+
return 0 == strlen((string) self::$_data);
108108
}
109109

110110
public function stream_read($count)
@@ -117,7 +117,7 @@ public function stream_read($count)
117117

118118
// To match the behavior of php://input, we need to clear out the data
119119
// as it is read
120-
if ($count > strlen(self::$_data)) {
120+
if ($count > strlen((string) self::$_data)) {
121121
$data = self::$_data;
122122
self::$_data = '';
123123
} else {

tests/Zend/Application/ApplicationTest.php

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Zend_Application_ApplicationTest extends \PHPUnit\Framework\TestCase
3232
public static function main()
3333
{
3434
$suite = new \PHPUnit\Framework\TestSuite(self::class);
35-
$result = \PHPUnit\TextUI\TestRunner::run($suite);
35+
$result = (new \PHPUnit\TextUI\TestRunner())->run($suite);
3636
}
3737

3838
public function setUp(): void
@@ -175,7 +175,7 @@ public function testPassingIncludePathOptionShouldModifyIncludePath()
175175
),
176176
));
177177
$test = get_include_path();
178-
$this->assertContains($expected, $test);
178+
$this->assertStringContainsString($expected, $test);
179179
}
180180

181181
public function testPassingPhpSettingsSetsIniValues()
@@ -244,11 +244,9 @@ public function testPassingArrayBootstrapOptionShouldRegisterBootstrapBasedOnPat
244244
$this->assertTrue($bootstrap instanceof ZfAppBootstrap);
245245
}
246246

247-
/**
248-
* @expectedException Zend_Application_Exception
249-
*/
250247
public function testPassingArrayBootstrapWithoutPathOptionShouldRaiseException()
251248
{
249+
$this->expectException(\Zend_Application_Exception::class);
252250
$this->application->setOptions(array(
253251
'bootstrap' => array(
254252
'class' => 'ZfAppBootstrap',
@@ -257,22 +255,18 @@ public function testPassingArrayBootstrapWithoutPathOptionShouldRaiseException()
257255
$bootstrap = $this->application->getBootstrap();
258256
}
259257

260-
/**
261-
* @expectedException Zend_Application_Exception
262-
*/
263258
public function testPassingInvalidBootstrapOptionShouldRaiseException()
264259
{
260+
$this->expectException(\Zend_Application_Exception::class);
265261
$this->application->setOptions(array(
266262
'bootstrap' => new stdClass(),
267263
));
268264
$bootstrap = $this->application->getBootstrap();
269265
}
270266

271-
/**
272-
* @expectedException Zend_Application_Exception
273-
*/
274267
public function testPassingInvalidOptionsArgumentToConstructorShouldRaiseException()
275268
{
269+
$this->expectException(\Zend_Application_Exception::class);
276270
$application = new Zend_Application('testing', new stdClass());
277271
}
278272

@@ -331,11 +325,9 @@ public function testPassingArrayOptionsWithConfigKeyShouldLoadOptionsAndNotOverr
331325
$this->assertNotEquals('bar', $application->getOption('foo'));
332326
}
333327

334-
/**
335-
* @expectedException Zend_Application_Exception
336-
*/
337328
public function testPassingInvalidStringOptionToConstructorShouldRaiseException()
338329
{
330+
$this->expectException(\Zend_Application_Exception::class);
339331
$application = new Zend_Application('testing', __DIR__ . '/_files/appconfig');
340332
}
341333

@@ -359,11 +351,9 @@ public function testBootstrapImplementsFluentInterface()
359351
$this->assertSame($application, $this->application);
360352
}
361353

362-
/**
363-
* @expectedException Zend_Application_Exception
364-
*/
365354
public function testApplicationShouldRaiseExceptionIfBootstrapFileDoesNotContainBootstrapClass()
366355
{
356+
$this->expectException(\Zend_Application_Exception::class);
367357
$this->application->setOptions(array(
368358
'bootstrap' => array(
369359
'path' => __DIR__ . '/_files/ZfAppNoBootstrap.php',
@@ -373,11 +363,9 @@ public function testApplicationShouldRaiseExceptionIfBootstrapFileDoesNotContain
373363
$bootstrap = $this->application->getBootstrap();
374364
}
375365

376-
/**
377-
* @expectedException Zend_Application_Exception
378-
*/
379366
public function testApplicationShouldRaiseExceptionWhenBootstrapClassNotOfCorrectType()
380367
{
368+
$this->expectException(\Zend_Application_Exception::class);
381369
$this->application->setOptions(array(
382370
'bootstrap' => array(
383371
'path' => __DIR__ . '/_files/ZfAppBadBootstrap.php',

0 commit comments

Comments
 (0)