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
|
|
|
|
{
|
2017-12-09 22:39:34 +00:00
|
|
|
/** @test */
|
|
|
|
public function its_lyrics_has_all_new_line_characters_replace_by_br_tags()
|
|
|
|
{
|
|
|
|
// Given a song with lyrics contains new line characters
|
|
|
|
/** @var Song $song */
|
|
|
|
$song = factory(Song::class)->create([
|
|
|
|
'lyrics' => "foo\rbar\nbaz\r\nqux",
|
|
|
|
]);
|
|
|
|
|
|
|
|
// When I retrieve its lyrics
|
|
|
|
$lyrics = $song->lyrics;
|
|
|
|
|
|
|
|
// Then I see the new line characters replaced by <br />
|
2020-09-06 18:21:39 +00:00
|
|
|
self::assertEquals('foo<br />bar<br />baz<br />qux', $lyrics);
|
2017-12-09 22:39:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/** @test */
|
|
|
|
public function amazon_s3_parameters_can_be_retrieved_from_s3_hosted_songs()
|
|
|
|
{
|
|
|
|
// Given a song hosted on S3
|
|
|
|
/** @var Song $song */
|
|
|
|
$song = factory(Song::class)->create(['path' => 's3://foo/bar']);
|
|
|
|
|
|
|
|
// When I check its S3 parameters
|
|
|
|
$params = $song->s3_params;
|
|
|
|
|
|
|
|
// Then I receive the correct parameters
|
2020-09-06 18:21:39 +00:00
|
|
|
self::assertEquals(['bucket' => 'foo', 'key' => 'bar'], $params);
|
2017-12-09 22:39:34 +00:00
|
|
|
}
|
2017-08-05 16:56:11 +00:00
|
|
|
}
|