diff --git a/app/Facades/Util.php b/app/Facades/Util.php new file mode 100644 index 00000000..b5a5f7ca --- /dev/null +++ b/app/Facades/Util.php @@ -0,0 +1,13 @@ +singleton('Util', function () { + return new Util(); + }); + } +} diff --git a/app/Services/Util.php b/app/Services/Util.php new file mode 100644 index 00000000..f0be5f90 --- /dev/null +++ b/app/Services/Util.php @@ -0,0 +1,46 @@ + Illuminate\Support\Facades\View::class, 'Media' => App\Facades\Media::class, + 'Util' => App\Facades\Util::class, ], diff --git a/tests/ArtistTest.php b/tests/ArtistTest.php index 3be7cea7..b3bb07d6 100644 --- a/tests/ArtistTest.php +++ b/tests/ArtistTest.php @@ -1,7 +1,6 @@ assertEquals(Artist::UNKNOWN_NAME, Artist::get('')->name); } - public function testNameWithWeirdCharacters() + public function testUtf16Names() { - // Don't really think this is even necessary if the user has set a proper utf8 encoding - // for the database. - $name = '��Ой°Ы&囧rz'; - $artist = factory(Artist::class)->create(['name' => $name]); + $name = file_get_contents(dirname(__FILE__) . '/stubs/utf16'); + + $artist = Artist::get($name); + $artist = Artist::get($name); // to make sure there's no constraint exception $this->assertEquals($artist->id, Artist::get($name)->id); } diff --git a/tests/stubs/utf16 b/tests/stubs/utf16 new file mode 100644 index 00000000..df7fe553 Binary files /dev/null and b/tests/stubs/utf16 differ