Skip to content

Commit 2a756f0

Browse files
committed
Upgrade PHPUnit
1 parent ddba3fb commit 2a756f0

11 files changed

Lines changed: 36 additions & 26 deletions

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"codeless/jugglecode": "1.0",
2626
"friendsofphp/php-cs-fixer": "^2.13",
2727
"php-coveralls/php-coveralls": "2.1",
28-
"phpunit/phpunit": "^4.8.35"
28+
"phpunit/phpunit": "^6.4 || ^7.4"
2929
},
3030
"autoload": {
3131
"psr-0": {

phpunit.xml.dist

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation='vendor/phpunit/phpunit/phpunit.xsd'
44
backupGlobals="true"
55
backupStaticAttributes="true"
66
colors="true"
@@ -15,18 +15,15 @@
1515
<log type="coverage-php" target="build/logs/coverage.cov"/>
1616
<log type="coverage-text" target="build/logs/coverage.txt" showUncoveredFiles="false"/>
1717
<log type="coverage-html" target="test/reports/coverage/" showUncoveredFiles="true"/>
18-
<log type="junit" target="test/reports/junit.xml" logIncompleteSkipped="false"/>
18+
<log type="junit" target="test/reports/junit.xml"/>
1919
</logging>
2020
<testsuites>
21-
<testsuite>
21+
<testsuite name="test">
2222
<directory>test/</directory>
2323
</testsuite>
2424
</testsuites>
2525
<filter>
26-
<blacklist>
27-
<directory suffix=".php">vendor/</directory>
28-
</blacklist>
29-
<whitelist addUncoveredFilesFromWhitelist="true">
26+
<whitelist>
3027
<directory suffix=".php">src/</directory>
3128
</whitelist>
3229
</filter>

test/Unit/Api/ClientErrorTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
namespace Bigcommerce\Unit\Api;
33

44
use Bigcommerce\Api\ClientError;
5+
use PHPUnit\Framework\TestCase;
56

6-
class ClientErrorTest extends \PHPUnit_Framework_TestCase
7+
class ClientErrorTest extends TestCase
78
{
89
public function testStringifyingReturnsTheMessageAndCodeAppropriately()
910
{

test/Unit/Api/ClientTest.php

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
use Bigcommerce\Api\Client;
66
use Bigcommerce\Api\Connection;
7+
use PHPUnit\Framework\TestCase;
78

8-
class ClientTest extends \PHPUnit_Framework_TestCase
9+
class ClientTest extends TestCase
910
{
1011
/**
1112
* @var Connection|\PHPUnit_Framework_MockObject_MockObject
@@ -52,19 +53,22 @@ public function tearDown()
5253

5354
public function testConfigureRequiresStoreUrl()
5455
{
55-
$this->setExpectedException('\\Exception', "'store_url' must be provided");
56+
$this->expectException('\\Exception');
57+
$this->expectExceptionMessage("'store_url' must be provided");
5658
Client::configure(array('username' => 'whatever', 'api_key' => 'whatever'));
5759
}
5860

5961
public function testConfigureRequiresUsername()
6062
{
61-
$this->setExpectedException('\\Exception', "'username' must be provided");
63+
$this->expectException('\\Exception');
64+
$this->expectExceptionMessage("'username' must be provided");
6265
Client::configure(array('store_url' => 'whatever', 'api_key' => 'whatever'));
6366
}
6467

6568
public function testConfigureRequiresApiKey()
6669
{
67-
$this->setExpectedException('\\Exception', "'api_key' must be provided");
70+
$this->expectException('\\Exception');
71+
$this->expectExceptionMessage("'api_key' must be provided");
6872
Client::configure(array('username' => 'whatever', 'store_url' => 'whatever'));
6973
}
7074

@@ -144,7 +148,8 @@ public function testGetCustomerLoginTokenThrowsIfNoClientSecret()
144148
'auth_token' => 'def',
145149
'store_hash' => 'abc'
146150
));
147-
$this->setExpectedException('\Exception', 'Cannot sign customer login tokens without a client secret');
151+
$this->expectException('\Exception');
152+
$this->expectExceptionMessage('Cannot sign customer login tokens without a client secret');
148153
Client::getCustomerLoginToken(1);
149154
}
150155

@@ -852,8 +857,8 @@ public function testDeletingAllGiftCertificatesDeletesToTheAllGiftCertificatesRe
852857

853858
Client::deleteAllGiftCertificates();
854859
}
855-
856-
860+
861+
857862
public function testGettingWebhooksReturnsAllWebhooks()
858863
{
859864
$this->connection->expects($this->once())
@@ -866,7 +871,7 @@ public function testGettingWebhooksReturnsAllWebhooks()
866871
$this->assertInstanceOf('Bigcommerce\\Api\\Resource', $resource);
867872
}
868873
}
869-
874+
870875
public function testGettingSpecifiedWebhookReturnsTheSpecifiedWebhook()
871876
{
872877
$this->connection->expects($this->once())
@@ -876,7 +881,7 @@ public function testGettingSpecifiedWebhookReturnsTheSpecifiedWebhook()
876881
$resource = Client::getWebhook(1);
877882
$this->assertInstanceOf('Bigcommerce\\Api\\Resource', $resource);
878883
}
879-
884+
880885
public function testCreatingWebhookPostsToTheSpecifiedResource()
881886
{
882887
$this->connection->expects($this->once())
@@ -891,7 +896,7 @@ public function testUpdatingWebhookPutsToTheSpecifiedResource()
891896
->with($this->basePath . '/hooks/1', (object)array());
892897
Client::updateWebhook(1, array());
893898
}
894-
899+
895900
public function testDeleteWebhookDeletesToTheSpecifiedResource()
896901
{
897902
$this->connection->expects($this->once())

test/Unit/Api/ConnectionTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
namespace Bigcommerce\Test\Unit;
44

55
use Bigcommerce\Api\Connection;
6+
use PHPUnit\Framework\TestCase;
67

7-
class ConnectionTest extends \PHPUnit_Framework_TestCase
8+
class ConnectionTest extends TestCase
89
{
910
/**
1011
* @var \Bigcommerce\Api\Connection;

test/Unit/Api/ErrorTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
namespace Bigcommerce\Test\Unit;
33

44
use Bigcommerce\Api\Error;
5+
use PHPUnit\Framework\TestCase;
56

6-
class ErrorTest extends \PHPUnit_Framework_TestCase
7+
class ErrorTest extends TestCase
78
{
89
public function testConstructorHandlesArrayOfMessageObjects()
910
{

test/Unit/Api/FilterTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
namespace Bigcommerce\Unit\Api;
33

44
use Bigcommerce\Api\Filter;
5+
use PHPUnit\Framework\TestCase;
56

6-
class FilterTest extends \PHPUnit_Framework_TestCase
7+
class FilterTest extends TestCase
78
{
89
public function testToQueryBuildsAnAppropriateQueryString()
910
{

test/Unit/Api/NetworkErrorTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
namespace Bigcommerce\Unit\Api;
33

44
use Bigcommerce\Api\NetworkError;
5+
use PHPUnit\Framework\TestCase;
56

6-
class NetworkErrorTest extends \PHPUnit_Framework_TestCase
7+
class NetworkErrorTest extends TestCase
78
{
89
public function testBehavesExactlyLikeException()
910
{

test/Unit/Api/ResourceTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
namespace Bigcommerce\Test\Unit\Api;
33

44
use Bigcommerce\Api\Resource;
5+
use PHPUnit\Framework\TestCase;
56

6-
class ResourceTest extends \PHPUnit_Framework_TestCase
7+
class ResourceTest extends TestCase
78
{
89
public function testGetCreateFieldsReturnsAllFieldsNotMarkedIgnore()
910
{

test/Unit/Api/Resources/ResourceTestBase.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33

44
use Bigcommerce\Api\Client;
55
use Bigcommerce\Api\Connection;
6+
use PHPUnit\Framework\TestCase;
67

7-
class ResourceTestBase extends \PHPUnit_Framework_TestCase
8+
class ResourceTestBase extends TestCase
89
{
910
/**
1011
* @var Connection|\PHPUnit_Framework_MockObject_MockObject

0 commit comments

Comments
 (0)