Page MenuHomeDevCentral

D1542.id3933.diff
No OneTemporary

D1542.id3933.diff

diff --git a/app/Phabricator/PhabricatorStory.php b/app/Phabricator/PhabricatorStory.php
--- a/app/Phabricator/PhabricatorStory.php
+++ b/app/Phabricator/PhabricatorStory.php
@@ -317,6 +317,11 @@
if (starts_with($key, "story")) {
$key = substr($key, 5);
+
+ if (strlen($key) === 0) {
+ return "";
+ }
+
$key[0] = strtolower($key[0]); // lowercase
}
diff --git a/tests/Phabricator/PhabricatorStoryTest.php b/tests/Phabricator/PhabricatorStoryTest.php
--- a/tests/Phabricator/PhabricatorStoryTest.php
+++ b/tests/Phabricator/PhabricatorStoryTest.php
@@ -22,4 +22,22 @@
yield ["VOID", ['foo' => 'bar']];
yield ["TASK", ['objectPHID' => 'PHID-TASK-l34fw5wievp6n6rnvpuk']];
}
+
+ /**
+ * @dataProvider provideKeys
+ */
+ public function testMapPhabricatorFeedKey ($expected, $key) {
+ $this->assertEquals(
+ $expected,
+ PhabricatorStory::mapPhabricatorFeedKey($key)
+ );
+ }
+
+ public function provideKeys () : iterable {
+ yield ['id', 'storyID'];
+ yield ['id', 'storyId'];
+ yield ['task', 'storyTask'];
+ yield ['', 'story'];
+ yield ['', ''];
+ }
}

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 16:33 (21 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2249632
Default Alt Text
D1542.id3933.diff (1 KB)

Event Timeline