Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3773592
D287.id677.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
D287.id677.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 07:47 (20 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2260591
Default Alt Text
D287.id677.diff (2 KB)
Attached To
Mode
D287: Tests for PhabricatorPayloadAnalyzer
Attached
Detach File
Event Timeline
Log In to Comment