Page MenuHomeDevCentral

D278.id654.diff
No OneTemporary

D278.id654.diff

diff --git a/tests/Analyzers/GitHub/GitHubPayloadAnalyzerTest.php b/tests/Analyzers/GitHub/GitHubPayloadAnalyzerTest.php
--- a/tests/Analyzers/GitHub/GitHubPayloadAnalyzerTest.php
+++ b/tests/Analyzers/GitHub/GitHubPayloadAnalyzerTest.php
@@ -22,6 +22,11 @@
*/
private $pushAnalyzer;
+ /**
+ * @var Nasqueron\Notifications\Analyzers\GitHub\GitHubPayloadAnalyzer
+ */
+ private $pushToMappedRepositoryAnalyzer;
+
/**
* Prepares the tests
*/
@@ -41,12 +46,22 @@
);
$filename = __DIR__ . "/../../data/payloads/GitHubEvents/push.json";
- $payload = json_decode(file_get_contents($filename));
+ $payloadRawContent = file_get_contents($filename);
+
+ $payload = json_decode($payloadRawContent);
$this->pushAnalyzer = new GitHubPayloadAnalyzer(
"Nasqueron", // Expected with known config
"push",
$payload
);
+
+ $dockerPayload = json_decode($payloadRawContent);
+ $dockerPayload->repository->name = "docker-someapp";
+ $this->pushToMappedRepositoryAnalyzer = new GitHubPayloadAnalyzer(
+ "Nasqueron", // Expected with known config
+ "push",
+ $dockerPayload
+ );
}
///
@@ -95,14 +110,31 @@
}
///
+ /// Test getGroup
+ ///
+
+ public function testGetGroupWhenEventIsAdministrative () {
+ $this->assertSame("orgz", $this->pingAnalyzer->getGroup());
+ }
+
+ public function testGetGroupOnPushToMappedRepository () {
+ $this->assertSame("docker", $this->pushToMappedRepositoryAnalyzer->getGroup());
+
+ }
+
+ public function testGetGroupOnPushToNotMappedRepository () {
+ $this->assertSame("nasqueron", $this->pushAnalyzer->getGroup());
+ }
+
+ ///
/// Test if our fallback is correct when the GitHub event type is unknown
///
- public function testDescriptionContainsTypeWhenEventTypeIsUnknown () {
- $this->assertContains(
- "quux",
- $this->unknownEventAnalyzer->getDescription()
- );
- }
+ public function testDescriptionContainsTypeWhenEventTypeIsUnknown () {
+ $this->assertContains(
+ "quux",
+ $this->unknownEventAnalyzer->getDescription()
+ );
+ }
}

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 16:50 (21 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2260413
Default Alt Text
D278.id654.diff (2 KB)

Event Timeline