Exemple #1
0
 public function testCleansUpBadStartIndexAndLineFeeds()
 {
     $reader = new SrtParser();
     $text = "0\n" . "00:00:04,630 --> 00:00:06,018\n" . "<i>Go ninja!</i>\n";
     $cleaner = new Cleaner();
     $cleanCaps = $cleaner->cleanupCaptions($reader->parse($text));
     $this->assertEquals(0, $cleaner->changes);
     $this->assertEquals("1\r\n" . "00:00:04,630 --> 00:00:06,018\r\n" . "<i>Go ninja!</i>\r\n" . "\r\n", SrtWriter::render($cleanCaps));
 }
 public function testWritesCleanDataToSrt()
 {
     $cap = new Caption();
     $cap->seq = 1;
     $cap->startTime = 6.053;
     $cap->duration = 2.085;
     $cap->text = array('<i>[Randy] I was chosen', 'to protect my school', 'from all evil</i>');
     $text = "1\r\n" . "00:00:06,053 --> 00:00:08,138\r\n" . "<i>[Randy] I was chosen\r\n" . "to protect my school\r\n" . "from all evil</i>\r\n" . "\r\n";
     $this->assertEquals($text, SrtWriter::render(array($cap)));
 }