2017-08-05 16:56:11 +00:00
|
|
|
<?php
|
|
|
|
|
2017-12-09 22:39:34 +00:00
|
|
|
namespace Tests\Integration\Models;
|
2017-08-05 16:56:11 +00:00
|
|
|
|
|
|
|
use App\Models\Song;
|
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
class SongTest extends TestCase
|
|
|
|
{
|
2020-12-22 20:11:22 +00:00
|
|
|
public function testLyricsHaveNewlinesReplacedByBrTags(): void
|
2017-12-09 22:39:34 +00:00
|
|
|
{
|
|
|
|
/** @var Song $song */
|
2020-11-14 16:57:25 +00:00
|
|
|
$song = Song::factory()->create([
|
2017-12-09 22:39:34 +00:00
|
|
|
'lyrics' => "foo\rbar\nbaz\r\nqux",
|
|
|
|
]);
|
|
|
|
|
2020-11-14 16:57:25 +00:00
|
|
|
self::assertEquals('foo<br />bar<br />baz<br />qux', $song->lyrics);
|
2017-12-09 22:39:34 +00:00
|
|
|
}
|
|
|
|
|
2020-11-14 16:57:25 +00:00
|
|
|
public function testGettingS3HostedSongs(): void
|
2017-12-09 22:39:34 +00:00
|
|
|
{
|
|
|
|
/** @var Song $song */
|
2020-11-14 16:57:25 +00:00
|
|
|
$song = Song::factory()->create(['path' => 's3://foo/bar']);
|
2017-12-09 22:39:34 +00:00
|
|
|
|
2020-11-14 16:57:25 +00:00
|
|
|
self::assertEquals(['bucket' => 'foo', 'key' => 'bar'], $song->s3_params);
|
2017-12-09 22:39:34 +00:00
|
|
|
}
|
2017-08-05 16:56:11 +00:00
|
|
|
}
|