You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -127,4 +142,109 @@ public function testExtractURLsHandleLongUrlWithInvalidDomainLabelsAndShortUrl()
127
142
),
128
143
), $extracted, 'Handle long url with invalid domain labels and short url');
129
144
}
145
+
146
+
/**
147
+
* @group Extractor
148
+
*/
149
+
publicfunctiontestExtract()
150
+
{
151
+
// @codingStandardsIgnoreStart
152
+
$text = '@someone Hey check out out @otheruser/list_name-01! This is #hashtag1 http://example.com Example cashtags: $TEST $Stock $symbol via @username';
153
+
// @codingStandardsIgnoreEnd
154
+
155
+
$extracted = $this->extractor->extract($text);
156
+
$expects = array(
157
+
'hashtags' => array(
158
+
'hashtag1'
159
+
),
160
+
'urls' => array(
161
+
'http://example.com'
162
+
),
163
+
'mentions' => array(
164
+
'someone',
165
+
'otheruser',
166
+
'username'
167
+
),
168
+
'replyto' => 'someone',
169
+
'hashtags_with_indices' => array(
170
+
array(
171
+
'hashtag' => 'hashtag1',
172
+
'indices' => array(60, 69)
173
+
)
174
+
),
175
+
'urls_with_indices' => array(
176
+
array(
177
+
'url' => 'http://example.com',
178
+
'indices' => array(70, 88)
179
+
)
180
+
),
181
+
'mentions_with_indices' => array(
182
+
array(
183
+
'screen_name' => 'someone',
184
+
'indices' => array(0, 8)
185
+
),
186
+
array(
187
+
'screen_name' => 'otheruser',
188
+
'indices' => array(27, 50)
189
+
),
190
+
array(
191
+
'screen_name' => 'username',
192
+
'indices' => array(132, 141)
193
+
)
194
+
)
195
+
);
196
+
197
+
$this->assertSame($expects, $extracted);
198
+
}
199
+
200
+
/**
201
+
* @group Extractor
202
+
*/
203
+
publicfunctiontestExtractEntitiesWithIndices()
204
+
{
205
+
// @codingStandardsIgnoreStart
206
+
$text = '@someone Hey check out out @otheruser/list_name-01! This is #hashtag1 http://example.com Example cashtags: $TEST $Stock $symbol via @username';
0 commit comments