Some text.
' .
'Valid link';
$paddedurl = str_pad($originalurl, 6000, 'z');
$validpaddedurl = 'Some text.
';
$validpaddedurl = str_pad($validpaddedurl, 6000 + (strlen($validpaddedurl) - strlen($originalurl)), 'z');
$invalidtexts = array(
'href="http://moodle.org/testfile/test.mp3"',
'test test',
'test test',
'test test',
'test test',
'sample',
'',
'test',
'test mp3',
'',
'test',
'test',
'test mp3',
'test mp3',
'test mp3',
// Test a long URL over 4096 characters.
$longurl
);
//test for invalid link
foreach ($invalidtexts as $text) {
$msg = "Testing text: ". $text;
$filter = $filterplugin->filter($text);
$this->assertEquals($text, $filter, $msg);
}
// Valid mediaurl followed by a longurl.
$precededlongurl = 'test.mp3'. $longurl;
$filter = $filterplugin->filter($precededlongurl);
$this->assertEquals(1, substr_count($filter, ''));
$this->assertStringContainsString($longurl, $filter);
// Testing for cases where: to be filtered content has 6+ text afterwards.
$filter = $filterplugin->filter($paddedurl);
$this->assertEquals($validpaddedurl, $filter, $msg);
}
}