Page MenuHomeDevCentral

D287.diff
No OneTemporary

D287.diff

diff --git a/tests/Analyzers/Phabricator/PhabricatorPayloadAnalyzerTest.php b/tests/Analyzers/Phabricator/PhabricatorPayloadAnalyzerTest.php
--- a/tests/Analyzers/Phabricator/PhabricatorPayloadAnalyzerTest.php
+++ b/tests/Analyzers/Phabricator/PhabricatorPayloadAnalyzerTest.php
@@ -29,12 +29,55 @@
);
}
+ public function testGetConfigurationFileName () {
+ $this->assertSame(
+ "PhabricatorPayloadAnalyzer/Nasqueron.json",
+ $this->analyzer->getConfigurationFileName()
+ );
+ }
+
+ public function testGetGroupWhereEventIsAdministrative () {
+ $this->markTestIncomplete(
+ "Not yet implemented feature. See T664."
+ );
+
+ $this->assertSame(
+ "orgz",
+ $this->analyzer->getGroup()
+ );
+ }
+
+ public function testGetGroupWhereStoryDoesntMatchAnything () {
+ $this->attachProjectsToStoryMock($this->story, []);
+ $this->assertSame(
+ "nasqueron",
+ $this->analyzer->getGroup()
+ );
+ }
+
+ public function testGetGroupWhereStoryMatchesProject () {
+ $this->attachProjectsToStoryMock($this->story, ['Docker images']);
+ $this->assertSame(
+ "docker",
+ $this->analyzer->getGroup()
+ );
+ }
+
+ public function testGetGroupWhereStoryMatchesWords () {
+ $this->attachProjectsToStoryMock($this->story, []);
+ $this->story->text = "Review the cartography elements.";
+ $this->assertSame(
+ "tasacora",
+ $this->analyzer->getGroup()
+ );
+ }
+
public function testGetGroupWhereWordsAreStrong () {
$this->markTestIncomplete(
- "Not yet implemented feature. See D748."
+ "Not yet implemented feature. See T748."
);
- $this->story->projects = ['Docker images'];
+ $this->attachProjectsToStoryMock($this->story, ['Docker images']);
$this->story->text = "Review the cartography elements on Dwellers.";
$this->assertSame(
diff --git a/tests/Analyzers/Phabricator/WithConfiguration.php b/tests/Analyzers/Phabricator/WithConfiguration.php
--- a/tests/Analyzers/Phabricator/WithConfiguration.php
+++ b/tests/Analyzers/Phabricator/WithConfiguration.php
@@ -20,7 +20,17 @@
}
private function getStory() {
- return new PhabricatorStory("https://phab.acme");
+ return $this
+ ->getMockBuilder("Nasqueron\Notifications\Phabricator\PhabricatorStory")
+ ->setConstructorArgs(["https://phab.acme"])
+ ->getMock();
+ }
+
+ private function attachProjectsToStoryMock ($mock, $projects) {
+ $mock
+ ->expects($this->any())
+ ->method("getProjects")
+ ->will($this->returnValue($projects));
}
}

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 05:38 (21 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2260591
Default Alt Text
D287.diff (2 KB)

Event Timeline