Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3764381
D598.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D598.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D598: Allow to get a TriggerBuild instance from DockerHubImage
Attached
Detach File
Event Timeline
Log In to Comment