Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3769464
D278.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D278.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 14:44 (18 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2260413
Default Alt Text
D278.diff (2 KB)
Attached To
Mode
D278: Test GitHubPayloadAnalyzerTest::getGroup()
Attached
Detach File
Event Timeline
Log In to Comment