Page MenuHomeDevCentral

D2709.id.diff
No OneTemporary

D2709.id.diff

diff --git a/composer.json b/composer.json
--- a/composer.json
+++ b/composer.json
@@ -18,14 +18,14 @@
"issues": "https://devcentral.nasqueron.org"
},
"require": {
- "php": ">=5.6.0",
- "guzzlehttp/psr7": "~1.3",
- "guzzlehttp/guzzle": "~6.0"
+ "php": ">=7.3",
+ "guzzlehttp/psr7": "^2.4.1",
+ "guzzlehttp/guzzle": "^7.5.0"
},
"require-dev": {
- "phpunit/phpunit": "5.0.*",
- "psy/psysh": "dev-master",
- "squizlabs/php_codesniffer": "*"
+ "phpunit/phpunit": "^9.0.0",
+ "psy/psysh": "^v0.11.8",
+ "squizlabs/php_codesniffer": "^3.7.1"
},
"autoload": {
"psr-4": {
diff --git a/phpunit.xml b/phpunit.xml
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
-<phpunit bootstrap="./vendor/autoload.php">
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ bootstrap="./vendor/autoload.php"
+ colors="true"
+ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
+ stopOnFailure="false">
<testsuites>
<testsuite name="Library test suite">
<directory>./tests/</directory>
diff --git a/tests/Build/Payloads/SourceRepositoryBuildPayloadTest.php b/tests/Build/Payloads/SourceRepositoryBuildPayloadTest.php
--- a/tests/Build/Payloads/SourceRepositoryBuildPayloadTest.php
+++ b/tests/Build/Payloads/SourceRepositoryBuildPayloadTest.php
@@ -4,7 +4,9 @@
use Keruald\DockerHub\Build\Payloads\SourceRepositoryBuildPayload;
-class SourceRepositoryBuildPayloadTest extends \PHPUnit_Framework_TestCase {
+use PHPUnit\Framework\TestCase;
+
+class SourceRepositoryBuildPayloadTest extends TestCase {
public function testIsValidType () {
$this->assertTrue(SourceRepositoryBuildPayload::isValidType('Tag'));
@@ -14,10 +16,8 @@
$this->assertFalse(SourceRepositoryBuildPayload::isValidType(null));
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testInvalidTypeThrowException () {
+ $this->expectException(\InvalidArgumentException::class);
$mock = new NotExistingObjectBuildPayloadMock();
}
diff --git a/tests/Build/TriggerBuildFactoryTest.php b/tests/Build/TriggerBuildFactoryTest.php
--- a/tests/Build/TriggerBuildFactoryTest.php
+++ b/tests/Build/TriggerBuildFactoryTest.php
@@ -8,7 +8,9 @@
use Keruald\DockerHub\Tests\WithMockHttpClient;
-class TriggerBuildFactoryTest extends \PHPUnit_Framework_TestCase {
+use PHPUnit\Framework\TestCase;
+
+class TriggerBuildFactoryTest extends TestCase {
use WithMockHttpClient;
@@ -17,7 +19,7 @@
*/
protected $factory;
- public function setUp () {
+ public function setUp () : void {
$client = self::mockHttpClient();
$tokens = self::mockTokens();
$this->factory = new TriggerBuildFactory($client, $tokens);
@@ -39,10 +41,8 @@
);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testGetForImageWithoutToken () {
+ $this->expectException(\Exception::class);
$this->factory->getForImage("acme/bar");
}
@@ -51,6 +51,7 @@
// We don't need to test the sendPayloadForAll method.
// So, we only need to check there is no exception or error.
$this->factory->build("acme/foo");
+ $this->expectNotToPerformAssertions();
}
public function testHasToken () {
diff --git a/tests/Build/TriggerBuildTest.php b/tests/Build/TriggerBuildTest.php
--- a/tests/Build/TriggerBuildTest.php
+++ b/tests/Build/TriggerBuildTest.php
@@ -10,7 +10,9 @@
use Keruald\DockerHub\Tests\WithMockHttpClient;
-class TriggerBuildTest extends \PHPUnit_Framework_TestCase {
+use PHPUnit\Framework\TestCase;
+
+class TriggerBuildTest extends TestCase {
use WithMockHttpClient;
@@ -24,7 +26,7 @@
*/
protected $image;
- public function setUp () {
+ public function setUp () : void {
$this->image = new DockerHubImage("acme", "foo");
$this->trigger = new TriggerBuild($this->image, "0000");
}
@@ -70,17 +72,13 @@
/// Overloads test
///
- /**
- * @expectedException \BadMethodCallException
- */
public function testMethodOverloadingForNonExistingMethod () {
+ $this->expectException(\BadMethodCallException::class);
$this->trigger->loremIpsum();
}
- /**
- * @expectedException \BadMethodCallException
- */
public function testMethodOverloadingForNonExistingPayloadMethod () {
+ $this->expectException(\BadMethodCallException::class);
$this->trigger->sendPayloadForLoremIpsum();
}
@@ -88,17 +86,13 @@
/// HTTP client tests
///
- /**
- * @expectedException \InvalidArgumentException
- */
public function testPostWhenClientIsNull () {
+ $this->expectException(\InvalidArgumentException::class);
$this->trigger->sendPayloadForAll();
}
- /**
- * @expectedException \RuntimeException
- */
public function testPostThrowsRuntimeExceptionWhenResponseIsNot200 () {
+ $this->expectException(\RuntimeException::class);
$mockClient = $this->mockHttpClient(500);
$trigger = new TriggerBuild($this->image, "0000", $mockClient);
$trigger->sendPayloadForAll();
diff --git a/tests/DockerHubImageTest.php b/tests/DockerHubImageTest.php
--- a/tests/DockerHubImageTest.php
+++ b/tests/DockerHubImageTest.php
@@ -5,7 +5,9 @@
use Keruald\DockerHub\DockerHubImage;
use Keruald\DockerHub\Build\TriggerBuild;
-class DockerHubImageTest extends \PHPUnit_Framework_TestCase {
+use PHPUnit\Framework\TestCase;
+
+class DockerHubImageTest extends TestCase {
use WithMockHttpClient;
@@ -14,7 +16,7 @@
*/
private $image;
- public function setUp () {
+ public function setUp () : void {
$this->image = new DockerHubImage("acme", "foo");
}
@@ -23,10 +25,8 @@
$this->assertEquals($slashNotationImage, $this->image);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testLoadFromSlashNotationWithInvalidArgument () {
+ $this->expectException(\Exception::class);
DockerHubImage::loadFromSlashNotation("foo");
}

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 23, 11:43 (11 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2312406
Default Alt Text
D2709.id.diff (6 KB)

Event Timeline