Skip to content

Commit be008d2

Browse files
committed
Updating to use PHPUnit 5.7 and 6.
1 parent 12d903d commit be008d2

12 files changed

+51
-27
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"consul-api"
1616
],
1717
"require": {
18-
"php": ">=5.6.0",
18+
"php": "^5.6 || ^7.0",
1919
"guzzlehttp/guzzle": "~6",
2020
"guzzlehttp/psr7": "~1"
2121
},
@@ -25,7 +25,7 @@
2525
}
2626
},
2727
"require-dev": {
28-
"phpunit/phpunit": "5.6.*"
28+
"phpunit/phpunit": "^5.7 || ^6.0"
2929
},
3030
"autoload-dev": {
3131
"psr-4": {

phpunit.local.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<phpunit
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.6/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.1/phpunit.xsd"
55
bootstrap="./vendor/autoload.php"
66
colors="true"
77
convertErrorsToExceptions="true"

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<phpunit
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.6/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.1/phpunit.xsd"
55
bootstrap="./vendor/autoload.php"
66
colors="true"
77
convertErrorsToExceptions="true"

src/Values.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,15 @@ public function add($key, $value) {
8282
throw new \InvalidArgumentException(sprintf('$key must be string, saw "%s".', gettype($key)));
8383
}
8484

85-
if (!is_string($value)) {
86-
throw new \InvalidArgumentException(sprintf('$value must be string, saw "%s".', gettype($value)));
87-
}
88-
89-
if (isset($this->values[$key])) {
90-
$this->values[$key][] = $value;
85+
if (settype($value, 'string')) {
86+
if (isset($this->values[$key])) {
87+
$this->values[$key][] = $value;
88+
} else {
89+
$this->values[$key] = [$value];
90+
}
9191
} else {
92-
$this->values[$key] = [$value];
92+
throw new \InvalidArgumentException(sprintf('$value must be castable to string, saw "%s".',
93+
gettype($value)));
9394
}
9495
}
9596

tests/Definition/AbstractDefinitionTestCases.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@
2424
use phpDocumentor\Reflection\Types\Integer;
2525
use phpDocumentor\Reflection\Types\Object_;
2626
use phpDocumentor\Reflection\Types\String_;
27+
use PHPUnit\Framework\TestCase;
2728

2829
/**
2930
* Class AbstractDefinitionTestCases
3031
* @package DCarbone\PHPConsulAPITests\Definition
3132
*/
32-
abstract class AbstractDefinitionTestCases extends \PHPUnit_Framework_TestCase {
33+
abstract class AbstractDefinitionTestCases extends TestCase {
3334
/** @var \ReflectionClass */
3435
protected $reflectionClass;
3536

tests/Definition/ConsulDefinitionTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818

1919
use DCarbone\PHPConsulAPI\Config;
2020
use DCarbone\PHPConsulAPI\Consul;
21+
use PHPUnit\Framework\TestCase;
2122

2223
/**
2324
* Class ConsulDefinitionTest
2425
* @package DCarbone\PHPConsulAPITests\Definition
2526
*/
26-
class ConsulDefinitionTest extends \PHPUnit_Framework_TestCase {
27+
class ConsulDefinitionTest extends TestCase {
2728

2829
protected $clientClassnames = [];
2930

tests/Usage/Agent/AgentClientUsageTests.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@
2323
use DCarbone\PHPConsulAPI\Agent\AgentServiceRegistration;
2424
use DCarbone\PHPConsulAPI\Config;
2525
use DCarbone\PHPConsulAPITests\ConsulManager;
26+
use PHPUnit\Framework\TestCase;
2627

2728
/**
2829
* Class AgentClientUsageTests
2930
* @package DCarbone\PHPConsulAPITests\Usage\Agent
3031
*/
31-
class AgentClientUsageTests extends \PHPUnit_Framework_TestCase {
32+
class AgentClientUsageTests extends TestCase {
3233

3334
const ServiceName = 'testservice';
3435

tests/Usage/ConfigUsageTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use DCarbone\PHPConsulAPI\Config;
44
use DCarbone\PHPConsulAPI\Consul;
55
use DCarbone\PHPConsulAPITests\ConsulManager;
6+
use PHPUnit\Framework\TestCase;
67

78
/*
89
Copyright 2016-2017 Daniel Carbone ([email protected])
@@ -24,7 +25,7 @@
2425
* Class ConfigUsageTest
2526
* @package DCarbone\PHPConsulAPITests\Usage
2627
*/
27-
class ConfigUsageTest extends \PHPUnit_Framework_TestCase {
28+
class ConfigUsageTest extends TestCase {
2829
const DEFAULT_ADDRESS = '127.0.0.1:8500';
2930
const DEFAULT_SCHEME = 'http';
3031

tests/Usage/KV/KVClientAdvancedTests.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616
limitations under the License.
1717
*/
1818

19+
use PHPUnit\Framework\TestCase;
20+
1921
/**
2022
* Class KVClientAdvancedTests
2123
* @package DCarbone\PHPConsulAPITests\Usage\KV
2224
*/
23-
class KVClientAdvancedTests extends \PHPUnit_Framework_TestCase {
25+
class KVClientAdvancedTests extends TestCase {
2426

2527
}

tests/Usage/KV/KVClientCRUDTests.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@
2323
use DCarbone\PHPConsulAPI\QueryMeta;
2424
use DCarbone\PHPConsulAPI\WriteMeta;
2525
use DCarbone\PHPConsulAPITests\ConsulManager;
26+
use PHPUnit\Framework\TestCase;
2627

2728
/**
2829
* Class KVClientCRUDTests
2930
* @package DCarbone\PHPConsulAPITests\Usage\KV
3031
*/
31-
class KVClientCRUDTests extends \PHPUnit_Framework_TestCase {
32+
class KVClientCRUDTests extends TestCase {
3233

3334
const KVKey1 = 'testkey1';
3435
const KVValue1 = 'testvalue1';

0 commit comments

Comments
 (0)