Commits

Norbert Nemetvolgyi  committed b623ebc

modified topic id conversion to handle 2 digit values

  • Participants
  • Parent commits de89113

Comments (0)

Files changed (2)

File src/ActivityID.php

      */
     private static function getTopicStr($activityID)
     {
-        return "M0" . strval(self::getTopicID($activityID));
+        return "M" . str_pad(self::getTopicID($activityID), 2, "0", STR_PAD_LEFT);
     }
 
     /**

File srcTest/ActivityIDTest.php

 
     public function testMethod_getActivityString_handlesTopicNumberCorrectlyForInt_4()
     {
-        $actual = substr(ActivityID::toString(4), -4, 2);
-        $this->assertEquals("02", $actual);
+        $actual = ActivityID::toString(4);
+        $this->assertEquals("L01M0201", $actual);
+    }
+
+    public function testMethod_getActivityString_handlesTopicNumberCorrectlyForInt_28()
+    {
+        $actual = ActivityID::toString(28);
+        $this->assertEquals("L01M1001", $actual);
     }
 }