示例#1
0
 /**
  * Test trimming of a # symbol before the hashtag
  *
  * @since 1.0.0
  *
  * @covers ::trim
  * @small
  *
  * @dataProvider trimmableHashtagProvider
  *
  * @param string $test_string string to test
  * @param string $message error message to display on fail
  *
  * @return void
  */
 public function testTrim($test_string, $message = '')
 {
     $this->assertEquals('hashtag', \Twitter\Helpers\Validators\Hashtag::trim($test_string), $message);
 }
示例#2
0
 /**
  * Add a hashtag
  *
  * @since 1.0.0
  *
  * @param string $hashtag hashtag
  *
  * @return __CLASS__ support chaining
  */
 public function addHashtag($hashtag)
 {
     $hashtag = \Twitter\Helpers\Validators\Hashtag::trim($hashtag);
     if ($hashtag) {
         $comparison_hashtag = mb_strtolower($hashtag);
         if (!isset($this->hashtags[$comparison_hashtag])) {
             $this->hashtags[$comparison_hashtag] = $hashtag;
         }
     }
     return $this;
 }