Skip to content

Commit e023fbe

Browse files
Replace @expectedException by $this->expectException()
1 parent c59a4d2 commit e023fbe

8 files changed

Lines changed: 44 additions & 63 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
.phpunit.result.cache
12
composer.lock
23
vendor

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ dist: trusty
22
language: php
33
sudo: true
44

5+
env:
6+
global:
7+
- SYMFONY_PHPUNIT_VERSION=5.7
8+
59
matrix:
610
fast_finish: true
711
include:
@@ -37,5 +41,5 @@ install:
3741
- composer update --prefer-source
3842

3943
script:
40-
- ./vendor/bin/phpunit --testsuite $SUITE
44+
- ./vendor/bin/simple-phpunit --testsuite $SUITE
4145

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"cache/tag-interop": "^1.0"
2929
},
3030
"require-dev": {
31-
"phpunit/phpunit": "^4.8.35|^5.4.3",
3231
"cache/cache": "^1.0",
3332
"symfony/cache": "^3.4.31|^4.3.4|^5.0",
3433
"symfony/phpunit-bridge": "^4.4",

phpunit.xml.dist

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,23 @@
4141
</exclude>
4242
</whitelist>
4343
</filter>
44+
45+
<listeners>
46+
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener">
47+
<arguments>
48+
<array>
49+
<element key="time-sensitive">
50+
<array>
51+
<element key="0"><string>Cache\IntegrationTests</string></element>
52+
<element key="2"><string>Symfony\Component\Cache</string></element>
53+
<element key="3"><string>Symfony\Component\Cache\Tests\Fixtures</string></element>
54+
<element key="4"><string>Symfony\Component\Cache\Tests\Traits</string></element>
55+
<element key="5"><string>Symfony\Component\Cache\Traits</string></element>
56+
</array>
57+
</element>
58+
</array>
59+
</arguments>
60+
</listener>
61+
</listeners>
62+
4463
</phpunit>

src/CachePoolTest.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,6 @@ public function testKeyLength()
559559
}
560560

561561
/**
562-
* @expectedException \Psr\Cache\InvalidArgumentException
563562
* @dataProvider invalidKeys
564563
*/
565564
public function testGetItemInvalidKeys($key)
@@ -568,11 +567,11 @@ public function testGetItemInvalidKeys($key)
568567
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
569568
}
570569

570+
$this->expectException('Psr\Cache\InvalidArgumentException');
571571
$this->cache->getItem($key);
572572
}
573573

574574
/**
575-
* @expectedException \Psr\Cache\InvalidArgumentException
576575
* @dataProvider invalidKeys
577576
*/
578577
public function testGetItemsInvalidKeys($key)
@@ -581,11 +580,11 @@ public function testGetItemsInvalidKeys($key)
581580
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
582581
}
583582

583+
$this->expectException('Psr\Cache\InvalidArgumentException');
584584
$this->cache->getItems(['key1', $key, 'key2']);
585585
}
586586

587587
/**
588-
* @expectedException \Psr\Cache\InvalidArgumentException
589588
* @dataProvider invalidKeys
590589
*/
591590
public function testHasItemInvalidKeys($key)
@@ -594,11 +593,11 @@ public function testHasItemInvalidKeys($key)
594593
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
595594
}
596595

596+
$this->expectException('Psr\Cache\InvalidArgumentException');
597597
$this->cache->hasItem($key);
598598
}
599599

600600
/**
601-
* @expectedException \Psr\Cache\InvalidArgumentException
602601
* @dataProvider invalidKeys
603602
*/
604603
public function testDeleteItemInvalidKeys($key)
@@ -607,11 +606,11 @@ public function testDeleteItemInvalidKeys($key)
607606
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
608607
}
609608

609+
$this->expectException('Psr\Cache\InvalidArgumentException');
610610
$this->cache->deleteItem($key);
611611
}
612612

613613
/**
614-
* @expectedException \Psr\Cache\InvalidArgumentException
615614
* @dataProvider invalidKeys
616615
*/
617616
public function testDeleteItemsInvalidKeys($key)
@@ -620,6 +619,7 @@ public function testDeleteItemsInvalidKeys($key)
620619
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
621620
}
622621

622+
$this->expectException('Psr\Cache\InvalidArgumentException');
623623
$this->cache->deleteItems(['key1', $key, 'key2']);
624624
}
625625

@@ -742,8 +742,6 @@ public function testBinaryData()
742742
{
743743
if (isset($this->skippedTests[__FUNCTION__])) {
744744
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
745-
746-
return;
747745
}
748746

749747
$data = '';

src/HierarchicalCachePoolTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ public function testBasicUsage()
5353
{
5454
if (isset($this->skippedTests[__FUNCTION__])) {
5555
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
56-
57-
return;
5856
}
5957

6058
$user = 4711;
@@ -73,8 +71,6 @@ public function testChain()
7371
{
7472
if (isset($this->skippedTests[__FUNCTION__])) {
7573
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
76-
77-
return;
7874
}
7975

8076
$item = $this->cache->getItem('|aaa|bbb|ccc|ddd');
@@ -117,8 +113,6 @@ public function testRemoval()
117113
{
118114
if (isset($this->skippedTests[__FUNCTION__])) {
119115
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
120-
121-
return;
122116
}
123117

124118
$item = $this->cache->getItem('foo');
@@ -138,8 +132,6 @@ public function testRemovalWhenDeferred()
138132
{
139133
if (isset($this->skippedTests[__FUNCTION__])) {
140134
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
141-
142-
return;
143135
}
144136

145137
$item = $this->cache->getItem('|aaa|bbb');

src/SimpleCacheTest.php

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,6 @@ public function testBasicUsageWithLongKey()
429429
}
430430

431431
/**
432-
* @expectedException \Psr\SimpleCache\InvalidArgumentException
433432
* @dataProvider invalidKeys
434433
*/
435434
public function testGetInvalidKeys($key)
@@ -438,11 +437,11 @@ public function testGetInvalidKeys($key)
438437
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
439438
}
440439

440+
$this->expectException('Psr\SimpleCache\InvalidArgumentException');
441441
$this->cache->get($key);
442442
}
443443

444444
/**
445-
* @expectedException \Psr\SimpleCache\InvalidArgumentException
446445
* @dataProvider invalidKeys
447446
*/
448447
public function testGetMultipleInvalidKeys($key)
@@ -451,23 +450,21 @@ public function testGetMultipleInvalidKeys($key)
451450
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
452451
}
453452

453+
$this->expectException('Psr\SimpleCache\InvalidArgumentException');
454454
$result = $this->cache->getMultiple(['key1', $key, 'key2']);
455455
}
456456

457-
/**
458-
* @expectedException \Psr\SimpleCache\InvalidArgumentException
459-
*/
460457
public function testGetMultipleNoIterable()
461458
{
462459
if (isset($this->skippedTests[__FUNCTION__])) {
463460
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
464461
}
465462

463+
$this->expectException('Psr\SimpleCache\InvalidArgumentException');
466464
$result = $this->cache->getMultiple('key');
467465
}
468466

469467
/**
470-
* @expectedException \Psr\SimpleCache\InvalidArgumentException
471468
* @dataProvider invalidKeys
472469
*/
473470
public function testSetInvalidKeys($key)
@@ -476,11 +473,11 @@ public function testSetInvalidKeys($key)
476473
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
477474
}
478475

476+
$this->expectException('Psr\SimpleCache\InvalidArgumentException');
479477
$this->cache->set($key, 'foobar');
480478
}
481479

482480
/**
483-
* @expectedException \Psr\SimpleCache\InvalidArgumentException
484481
* @dataProvider invalidArrayKeys
485482
*/
486483
public function testSetMultipleInvalidKeys($key)
@@ -494,23 +491,21 @@ public function testSetMultipleInvalidKeys($key)
494491
yield $key => 'bar';
495492
yield 'key2' => 'baz';
496493
};
494+
$this->expectException('Psr\SimpleCache\InvalidArgumentException');
497495
$this->cache->setMultiple($values());
498496
}
499497

500-
/**
501-
* @expectedException \Psr\SimpleCache\InvalidArgumentException
502-
*/
503498
public function testSetMultipleNoIterable()
504499
{
505500
if (isset($this->skippedTests[__FUNCTION__])) {
506501
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
507502
}
508503

504+
$this->expectException('Psr\SimpleCache\InvalidArgumentException');
509505
$this->cache->setMultiple('key');
510506
}
511507

512508
/**
513-
* @expectedException \Psr\SimpleCache\InvalidArgumentException
514509
* @dataProvider invalidKeys
515510
*/
516511
public function testHasInvalidKeys($key)
@@ -519,11 +514,11 @@ public function testHasInvalidKeys($key)
519514
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
520515
}
521516

517+
$this->expectException('Psr\SimpleCache\InvalidArgumentException');
522518
$this->cache->has($key);
523519
}
524520

525521
/**
526-
* @expectedException \Psr\SimpleCache\InvalidArgumentException
527522
* @dataProvider invalidKeys
528523
*/
529524
public function testDeleteInvalidKeys($key)
@@ -532,11 +527,11 @@ public function testDeleteInvalidKeys($key)
532527
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
533528
}
534529

530+
$this->expectException('Psr\SimpleCache\InvalidArgumentException');
535531
$this->cache->delete($key);
536532
}
537533

538534
/**
539-
* @expectedException \Psr\SimpleCache\InvalidArgumentException
540535
* @dataProvider invalidKeys
541536
*/
542537
public function testDeleteMultipleInvalidKeys($key)
@@ -545,23 +540,21 @@ public function testDeleteMultipleInvalidKeys($key)
545540
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
546541
}
547542

543+
$this->expectException('Psr\SimpleCache\InvalidArgumentException');
548544
$this->cache->deleteMultiple(['key1', $key, 'key2']);
549545
}
550546

551-
/**
552-
* @expectedException \Psr\SimpleCache\InvalidArgumentException
553-
*/
554547
public function testDeleteMultipleNoIterable()
555548
{
556549
if (isset($this->skippedTests[__FUNCTION__])) {
557550
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
558551
}
559552

553+
$this->expectException('Psr\SimpleCache\InvalidArgumentException');
560554
$this->cache->deleteMultiple('key');
561555
}
562556

563557
/**
564-
* @expectedException \Psr\SimpleCache\InvalidArgumentException
565558
* @dataProvider invalidTtl
566559
*/
567560
public function testSetInvalidTtl($ttl)
@@ -570,11 +563,11 @@ public function testSetInvalidTtl($ttl)
570563
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
571564
}
572565

566+
$this->expectException('Psr\SimpleCache\InvalidArgumentException');
573567
$this->cache->set('key', 'value', $ttl);
574568
}
575569

576570
/**
577-
* @expectedException \Psr\SimpleCache\InvalidArgumentException
578571
* @dataProvider invalidTtl
579572
*/
580573
public function testSetMultipleInvalidTtl($ttl)
@@ -583,6 +576,7 @@ public function testSetMultipleInvalidTtl($ttl)
583576
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
584577
}
585578

579+
$this->expectException('Psr\SimpleCache\InvalidArgumentException');
586580
$this->cache->setMultiple(['key' => 'value'], $ttl);
587581
}
588582

0 commit comments

Comments
 (0)