Page MenuHomeDevCentral

D598.diff
No OneTemporary

D598.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
Sat, Nov 23, 05:24 (18 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2257309
Default Alt Text
D598.diff (1 KB)

Event Timeline