Skip to content

Commit 424a926

Browse files
committed
Upgraded PHPUnit ^4.8 -> ^7.
1 parent 7253567 commit 424a926

19 files changed

Lines changed: 66 additions & 45 deletions

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"psr/cache": "^1"
1919
},
2020
"require-dev": {
21-
"phpunit/phpunit": "^4.8",
21+
"phpunit/phpunit": "^7.1.3",
2222
"mockery/mockery": "^1"
2323
},
2424
"suggest" : {

test/Integration/Porter/Collection/CountableProviderRecordsTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<?php
22
namespace ScriptFUSIONTest\Integration\Porter\Collection;
33

4+
use PHPUnit\Framework\TestCase;
45
use ScriptFUSION\Porter\Collection\CountableProviderRecords;
56
use ScriptFUSION\Porter\Provider\Resource\ProviderResource;
67

78
/**
89
* @see CountableProviderRecords
910
*/
10-
final class CountableProviderRecordsTest extends \PHPUnit_Framework_TestCase
11+
final class CountableProviderRecordsTest extends TestCase
1112
{
1213
/**
1314
* Tests that counting the collection matches the passed count value.

test/Integration/Porter/Connector/CachingConnectorTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
55
use Mockery\MockInterface;
6+
use PHPUnit\Framework\TestCase;
67
use Psr\Cache\CacheItemInterface;
78
use Psr\Cache\CacheItemPoolInterface;
89
use ScriptFUSION\Porter\Cache\CacheKeyGenerator;
@@ -18,7 +19,7 @@
1819
/**
1920
* @see CachingConnector
2021
*/
21-
final class CachingConnectorTest extends \PHPUnit_Framework_TestCase
22+
final class CachingConnectorTest extends TestCase
2223
{
2324
use MockeryPHPUnitIntegration;
2425

@@ -178,7 +179,8 @@ public function testFetchThrowsInvalidCacheKeyExceptionOnNonStringCacheKey(): vo
178179
->getMock()
179180
);
180181

181-
$this->setExpectedException(InvalidCacheKeyException::class, 'Cache key must be a string.');
182+
$this->expectException(InvalidCacheKeyException::class);
183+
$this->expectExceptionMessage('Cache key must be a string.');
182184
$connector->fetch($this->context, 'baz');
183185
}
184186

@@ -192,7 +194,8 @@ public function testFetchThrowsInvalidCacheKeyExceptionOnNonPSR6CompliantCacheKe
192194
->getMock()
193195
);
194196

195-
$this->setExpectedException(InvalidCacheKeyException::class, 'contains one or more reserved characters');
197+
$this->expectException(InvalidCacheKeyException::class);
198+
$this->expectExceptionMessage('contains one or more reserved characters');
196199
$connector->fetch($this->context, 'baz');
197200
}
198201

test/Integration/Porter/Connector/ConnectionContextTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
namespace ScriptFUSIONTest\Integration\Porter\Connector;
33

4+
use PHPUnit\Framework\TestCase;
45
use ScriptFUSION\Porter\Connector\ConnectionContext;
56
use ScriptFUSION\Porter\Connector\FetchExceptionHandler\StatelessFetchExceptionHandler;
67
use ScriptFUSION\Porter\Connector\RecoverableConnectorException;
@@ -10,7 +11,7 @@
1011
/**
1112
* @see ConnectionContext
1213
*/
13-
final class ConnectionContextTest extends \PHPUnit_Framework_TestCase
14+
final class ConnectionContextTest extends TestCase
1415
{
1516
/**
1617
* Tests that when retry() is called multiple times, the original fetch exception handler is unmodified.

test/Integration/Porter/PorterTest.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
55
use Mockery\MockInterface;
6+
use PHPUnit\Framework\TestCase;
67
use Psr\Container\ContainerInterface;
78
use ScriptFUSION\Porter\Cache\CacheUnavailableException;
89
use ScriptFUSION\Porter\Collection\FilteredRecords;
@@ -30,7 +31,7 @@
3031
use ScriptFUSION\Retry\FailingTooHardException;
3132
use ScriptFUSIONTest\MockFactory;
3233

33-
final class PorterTest extends \PHPUnit_Framework_TestCase
34+
final class PorterTest extends TestCase
3435
{
3536
use MockeryPHPUnitIntegration;
3637

@@ -133,7 +134,7 @@ public function testImportConnectorWithOptions(): void
133134
$this->provider->shouldReceive('getConnector')
134135
->andReturn(\Mockery::mock(Connector::class, ConnectorOptions::class));
135136

136-
$this->setExpectedException(\LogicException::class);
137+
$this->expectException(\LogicException::class);
137138
$this->porter->import($this->specification);
138139
}
139140

@@ -181,13 +182,14 @@ public function testImportFailure(): void
181182
{
182183
$this->resource->shouldReceive('fetch')->andReturn(null);
183184

184-
$this->setExpectedException(\TypeError::class, \get_class($this->resource));
185+
$this->expectException(\TypeError::class);
186+
$this->expectExceptionMessage(\get_class($this->resource));
185187
$this->porter->import($this->specification);
186188
}
187189

188190
public function testImportUnregisteredProvider(): void
189191
{
190-
$this->setExpectedException(ProviderNotFoundException::class);
192+
$this->expectException(ProviderNotFoundException::class);
191193

192194
$this->porter->import($this->specification->setProviderName('foo'));
193195
}
@@ -200,7 +202,7 @@ public function testImportForeignResource(): void
200202
// Replace existing provider with a different one.
201203
$this->registerProvider(MockFactory::mockProvider(), get_class($this->provider));
202204

203-
$this->setExpectedException(ForeignResourceException::class);
205+
$this->expectException(ForeignResourceException::class);
204206
$this->porter->import($this->specification);
205207
}
206208

@@ -228,7 +230,7 @@ public function testImportOneOfMany(): void
228230
{
229231
$this->resource->shouldReceive('fetch')->andReturn(new \ArrayIterator([['foo'], ['bar']]));
230232

231-
$this->setExpectedException(ImportException::class);
233+
$this->expectException(ImportException::class);
232234
$this->porter->importOne($this->specification);
233235
}
234236

@@ -243,7 +245,7 @@ public function testOneTry(): void
243245
{
244246
$this->arrangeConnectorException(new RecoverableConnectorException);
245247

246-
$this->setExpectedException(FailingTooHardException::class, '1');
248+
$this->expectException(FailingTooHardException::class, '1');
247249
$this->porter->import($this->specification->setMaxFetchAttempts(1));
248250
}
249251

@@ -255,7 +257,7 @@ public function testDerivedRecoverableException(): void
255257
{
256258
$this->arrangeConnectorException(new RecoverableConnectorException);
257259

258-
$this->setExpectedException(FailingTooHardException::class);
260+
$this->expectException(FailingTooHardException::class);
259261
$this->porter->import($this->specification->setMaxFetchAttempts(1));
260262
}
261263

@@ -267,10 +269,8 @@ public function testDefaultTries(): void
267269
{
268270
$this->arrangeConnectorException(new RecoverableConnectorException);
269271

270-
$this->setExpectedException(
271-
FailingTooHardException::class,
272-
(string)ImportSpecification::DEFAULT_FETCH_ATTEMPTS
273-
);
272+
$this->expectException(FailingTooHardException::class);
273+
$this->expectExceptionMessage((string)ImportSpecification::DEFAULT_FETCH_ATTEMPTS);
274274
$this->porter->import($this->specification);
275275
}
276276

@@ -282,7 +282,7 @@ public function testUnrecoverableException(): void
282282
// Subclass Exception so it's not an ancestor of any other exception.
283283
$this->arrangeConnectorException($exception = \Mockery::mock(\Exception::class));
284284

285-
$this->setExpectedException(get_class($exception));
285+
$this->expectException(get_class($exception));
286286
$this->porter->import($this->specification);
287287
}
288288

@@ -303,7 +303,7 @@ public function testCustomFetchExceptionHandler(): void
303303

304304
$this->arrangeConnectorException(new RecoverableConnectorException);
305305

306-
$this->setExpectedException(FailingTooHardException::class);
306+
$this->expectException(FailingTooHardException::class);
307307
$this->porter->import($this->specification);
308308
}
309309

@@ -335,7 +335,7 @@ function (\Exception $exception) use ($connectorException) {
335335
})
336336
;
337337

338-
$this->setExpectedException(\RuntimeException::class);
338+
$this->expectException(\RuntimeException::class);
339339
$this->porter->importOne($this->specification);
340340
}
341341

@@ -371,7 +371,7 @@ static function () {
371371
*/
372372
public function testCacheUnavailable(): void
373373
{
374-
$this->setExpectedException(CacheUnavailableException::class);
374+
$this->expectException(CacheUnavailableException::class);
375375

376376
$this->porter->import($this->specification->enableCache());
377377
}

test/Integration/Porter/Specification/StaticDataImportSpecificationTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<?php
22
namespace ScriptFUSIONTest\Integration\Porter\Specification;
33

4+
use PHPUnit\Framework\TestCase;
45
use Psr\Container\ContainerInterface;
56
use ScriptFUSION\Porter\Porter;
67
use ScriptFUSION\Porter\Specification\StaticDataImportSpecification;
78

89
/**
910
* @see StaticDataImportSpecification
1011
*/
11-
final class StaticDataImportSpecificationTest extends \PHPUnit_Framework_TestCase
12+
final class StaticDataImportSpecificationTest extends TestCase
1213
{
1314
public function test(): void
1415
{

test/Unit/Porter/Cache/CacheItemTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
22
namespace ScriptFUSIONTest\Unit\Porter\Cache;
33

4+
use PHPUnit\Framework\TestCase;
45
use ScriptFUSION\Porter\Cache\CacheItem;
56
use ScriptFUSION\Porter\Cache\NotImplementedException;
67

7-
final class CacheItemTest extends \PHPUnit_Framework_TestCase
8+
final class CacheItemTest extends TestCase
89
{
910
/** @var CacheItem */
1011
private $item;
@@ -36,14 +37,14 @@ public function testSet(): void
3637

3738
public function testExpiresAt(): void
3839
{
39-
$this->setExpectedException(NotImplementedException::class);
40+
$this->expectException(NotImplementedException::class);
4041

4142
$this->item->expiresAt(null);
4243
}
4344

4445
public function testExpiresAfter(): void
4546
{
46-
$this->setExpectedException(NotImplementedException::class);
47+
$this->expectException(NotImplementedException::class);
4748

4849
$this->item->expiresAfter(null);
4950
}

test/Unit/Porter/Cache/JsonCacheKeyGeneratorTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
22
namespace ScriptFUSIONTest\Unit\Porter\Cache;
33

4+
use PHPUnit\Framework\TestCase;
45
use ScriptFUSION\Porter\Cache\JsonCacheKeyGenerator;
56
use ScriptFUSIONTest\Stubs\TestOptions;
67

7-
final class JsonCacheKeyGeneratorTest extends \PHPUnit_Framework_TestCase
8+
final class JsonCacheKeyGeneratorTest extends TestCase
89
{
910
public function testGenerateCacheKey(): void
1011
{

test/Unit/Porter/Cache/MemoryCacheTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<?php
22
namespace ScriptFUSIONTest\Unit\Porter\Cache;
33

4+
use PHPUnit\Framework\TestCase;
45
use ScriptFUSION\Porter\Cache\CacheItem;
56
use ScriptFUSION\Porter\Cache\InvalidArgumentException;
67
use ScriptFUSION\Porter\Cache\MemoryCache;
78

8-
final class MemoryCacheTest extends \PHPUnit_Framework_TestCase
9+
final class MemoryCacheTest extends TestCase
910
{
1011
/** @var MemoryCache */
1112
private $cache;
@@ -69,7 +70,7 @@ public function testDeleteItems(): void
6970

7071
public function testDeleteInvalidItem(): void
7172
{
72-
$this->setExpectedException(InvalidArgumentException::class);
73+
$this->expectException(InvalidArgumentException::class);
7374

7475
$this->cache->deleteItems(['foo', 'bar']);
7576
}

test/Unit/Porter/Collection/PorterRecordsTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<?php
22
namespace ScriptFUSIONTest\Unit\Porter\Collection;
33

4+
use PHPUnit\Framework\TestCase;
45
use ScriptFUSION\Porter\Collection\PorterRecords;
56
use ScriptFUSION\Porter\Collection\RecordCollection;
67
use ScriptFUSION\Porter\Specification\ImportSpecification;
78

8-
final class PorterRecordsTest extends \PHPUnit_Framework_TestCase
9+
final class PorterRecordsTest extends TestCase
910
{
1011
public function test(): void
1112
{

0 commit comments

Comments
 (0)