Page MenuHomeDevCentral

D598.id.diff
No OneTemporary

D598.id.diff

diff --git a/src/DockerHubImage.php b/src/DockerHubImage.php
--- a/src/DockerHubImage.php
+++ b/src/DockerHubImage.php
@@ -2,6 +2,8 @@
namespace Keruald\DockerHub;
+use Keruald\DockerHub\Build\TriggerBuild;
+
/**
* Represents a DockerHub image.
*/
@@ -11,4 +13,15 @@
return "https://registry.hub.docker.com/u/$this->user/$this->image";
}
+ /**
+ * Gets a trigger build for this image
+ * to be able to prepare a build trigger payload.
+ *
+ * @param string $token The token to authentify the build request
+ * @return Keruald\DockerHub\Build\TriggerBuild
+ */
+ public function getTriggerBuild ($token) {
+ return new TriggerBuild($this, $token);
+ }
+
}
diff --git a/tests/DockerHubImageTest.php b/tests/DockerHubImageTest.php
--- a/tests/DockerHubImageTest.php
+++ b/tests/DockerHubImageTest.php
@@ -3,14 +3,30 @@
namespace Keruald\DockerHub\Tests;
use Keruald\DockerHub\DockerHubImage;
+use Keruald\DockerHub\Build\TriggerBuild;
class DockerHubImageTest extends \PHPUnit_Framework_TestCase {
+ /**
+ * @var Keruald\DockerHub\DockerHubImage
+ */
+ private $image;
+
+ public function setUp () {
+ $this->image = new DockerHubImage("acme", "foo");
+ }
+
public function testGetRegistryUrl () {
- $image = new DockerHubImage("acme", "foo");
$this->assertSame(
"https://registry.hub.docker.com/u/acme/foo",
- $image->getRegistryUrl()
+ $this->image->getRegistryUrl()
+ );
+ }
+
+ public function testGetTriggerBuild () {
+ $this->assertInstanceOf(
+ TriggerBuild::class,
+ $this->image->getTriggerBuild('0000')
);
}

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 23, 04:51 (5 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2311685
Default Alt Text
D598.id.diff (1 KB)

Event Timeline