Page MenuHomeDevCentral

D653.diff
No OneTemporary

D653.diff

diff --git a/src/Build/TriggerBuildFactory.php b/src/Build/TriggerBuildFactory.php
--- a/src/Build/TriggerBuildFactory.php
+++ b/src/Build/TriggerBuildFactory.php
@@ -70,12 +70,19 @@
$this->getForImage($image)->sendPayloadForAll();
}
+ /**
+ * @return bool
+ */
+ public function hasToken ($image) {
+ return array_key_exists($image, $this->tokens);
+ }
+
///
/// Helper methods
///
protected function getToken ($image) {
- if (array_key_exists($image, $this->tokens)) {
+ if ($this->hasToken($image)) {
return $this->tokens[$image];
}
diff --git a/tests/Build/TriggerBuildFactoryTest.php b/tests/Build/TriggerBuildFactoryTest.php
--- a/tests/Build/TriggerBuildFactoryTest.php
+++ b/tests/Build/TriggerBuildFactoryTest.php
@@ -53,4 +53,12 @@
$this->factory->build("acme/foo");
}
+ public function testHasToken () {
+ $this->assertTrue($this->factory->hasToken("acme/foo"));
+ }
+
+ public function testHasTokenWhenWeDoNot () {
+ $this->assertFalse($this->factory->hasToken("acme/bar"));
+ }
+
}

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 26, 23:34 (11 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2265255
Default Alt Text
D653.diff (1 KB)

Event Timeline