1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
<?php
namespace JamesHeinrich\GetID3\Tests;
use JamesHeinrich\GetID3\GetID3;
use JamesHeinrich\GetID3\WriteTags;
class Mp3Test extends \PHPUnit\Framework\TestCase
{
public function testRead()
{
$filename = __DIR__ . "/files/silence.mp3";
$band = "Protest The Hero";
$year = 2010;
$writer = new WriteTags;
$writer->filename = $filename;
$writer->tagformats = ["id3v2.4"];
$writer->tag_encoding = "UTF-8";
$writer->overwrite_tags = true;
$writer->tag_data = [
"band" => [$band],
"recording_time" => [$year],
];
$writer->WriteTags();
$getID3 = new GetID3;
$tags = $getID3->analyze($filename)["tags"]["id3v2"];
$this->assertSame($band, $tags["band"][0]);
$this->assertSame((string) $year, $tags["year"][0]);
$this->assertSame((string) $year, $tags["recording_time"][0]);
}
}
|