Apply fixes from StyleCI (#679)

This commit is contained in:
Phan An 2017-11-08 22:35:36 +01:00 committed by GitHub
parent 365ea3d9ad
commit d571575756
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,53 +9,53 @@ use Tests\TestCase;
class FileTest extends TestCase
{
use DatabaseTransactions;
use DatabaseTransactions;
/** @test */
public function it_can_be_instantiated()
{
$file = new File(__DIR__.'/../songs/full.mp3');
$this->assertInstanceOf(File::class, $file);
$file = new File(new SplFileInfo(__DIR__.'/../songs/full.mp3'));
$this->assertInstanceOf(File::class, $file);
}
/** @test */
public function it_can_be_instantiated()
{
$file = new File(__DIR__.'/../songs/full.mp3');
$this->assertInstanceOf(File::class, $file);
$file = new File(new SplFileInfo(__DIR__.'/../songs/full.mp3'));
$this->assertInstanceOf(File::class, $file);
}
/** @test */
public function file_info_is_retrieved_correctly()
{
$file = new File(__DIR__.'/../songs/full.mp3');
$info = $file->getInfo();
/** @test */
public function file_info_is_retrieved_correctly()
{
$file = new File(__DIR__.'/../songs/full.mp3');
$info = $file->getInfo();
$expectedData = [
'artist' => 'Koel',
'album' => 'Koel Testing Vol. 1',
'compilation' => false,
'title' => 'Amet',
'track' => 5,
'lyrics' => '',
'cover' => [
'data' => file_get_contents(__DIR__.'/../blobs/cover.png'),
'image_mime' => 'image/png',
'image_width' => 512,
'image_height' => 512,
'imagetype' => 'PNG',
'picturetype' => 'Other',
'description' => '',
'datalength' => 7627,
],
'path' => __DIR__.'/../songs/full.mp3',
'mtime' => filemtime(__DIR__.'/../songs/full.mp3'),
'albumartist' => '',
];
$expectedData = [
'artist' => 'Koel',
'album' => 'Koel Testing Vol. 1',
'compilation' => false,
'title' => 'Amet',
'track' => 5,
'lyrics' => '',
'cover' => [
'data' => file_get_contents(__DIR__.'/../blobs/cover.png'),
'image_mime' => 'image/png',
'image_width' => 512,
'image_height' => 512,
'imagetype' => 'PNG',
'picturetype' => 'Other',
'description' => '',
'datalength' => 7627,
],
'path' => __DIR__.'/../songs/full.mp3',
'mtime' => filemtime(__DIR__.'/../songs/full.mp3'),
'albumartist' => '',
];
$this->assertArraySubset($expectedData, $info);
$this->assertEquals(10.083, $info['length'], '', 0.001);
}
$this->assertArraySubset($expectedData, $info);
$this->assertEquals(10.083, $info['length'], '', 0.001);
}
/** @test */
public function song_without_a_title_tag_has_file_name_as_the_title()
{
$file = new File(__DIR__.'/../songs/blank.mp3');
$this->assertSame('blank', $file->getInfo()['title']);
}
/** @test */
public function song_without_a_title_tag_has_file_name_as_the_title()
{
$file = new File(__DIR__.'/../songs/blank.mp3');
$this->assertSame('blank', $file->getInfo()['title']);
}
}