neues Admin UI Layout eingeführt. Alle Tests auf den neusten Stand gebracht.
This commit is contained in:
@@ -189,4 +189,120 @@ class SyncGoogleFontsTest extends TestCase
|
||||
|
||||
File::deleteDirectory($targetPath);
|
||||
}
|
||||
|
||||
public function test_it_downloads_multiple_families_in_one_run(): void
|
||||
{
|
||||
$targetPath = storage_path('app/test-fonts');
|
||||
File::deleteDirectory($targetPath);
|
||||
|
||||
Http::fake([
|
||||
'https://www.googleapis.com/webfonts/v1/webfonts*' => Http::response([
|
||||
'items' => [
|
||||
[
|
||||
'family' => 'Alpha Sans',
|
||||
'category' => 'sans-serif',
|
||||
'files' => [
|
||||
'regular' => 'https://fonts.gstatic.com/s/alpha-regular.woff2',
|
||||
],
|
||||
],
|
||||
[
|
||||
'family' => 'Beta Serif',
|
||||
'category' => 'serif',
|
||||
'files' => [
|
||||
'regular' => 'https://fonts.gstatic.com/s/beta-regular.woff2',
|
||||
],
|
||||
],
|
||||
],
|
||||
]),
|
||||
'https://fonts.gstatic.com/*' => Http::response('font-binary', 200),
|
||||
]);
|
||||
|
||||
Artisan::call('fonts:sync-google', [
|
||||
'--family' => 'Alpha Sans, Beta Serif',
|
||||
'--path' => 'storage/app/test-fonts',
|
||||
'--force' => true,
|
||||
]);
|
||||
|
||||
$manifestPath = $targetPath.'/manifest.json';
|
||||
$manifest = json_decode(File::get($manifestPath), true);
|
||||
|
||||
$this->assertSame(2, $manifest['count']);
|
||||
$this->assertCount(2, $manifest['fonts']);
|
||||
$this->assertTrue(collect($manifest['fonts'])->pluck('family')->contains('Alpha Sans'));
|
||||
$this->assertTrue(collect($manifest['fonts'])->pluck('family')->contains('Beta Serif'));
|
||||
|
||||
File::deleteDirectory($targetPath);
|
||||
}
|
||||
|
||||
public function test_it_merges_existing_manifest_when_syncing_single_family(): void
|
||||
{
|
||||
$targetPath = storage_path('app/test-fonts');
|
||||
File::deleteDirectory($targetPath);
|
||||
|
||||
Http::fake([
|
||||
'https://www.googleapis.com/webfonts/v1/webfonts*' => Http::response([
|
||||
'items' => [
|
||||
[
|
||||
'family' => 'Alpha Sans',
|
||||
'category' => 'sans-serif',
|
||||
'files' => [
|
||||
'regular' => 'https://fonts.gstatic.com/s/alpha-regular.woff2',
|
||||
],
|
||||
],
|
||||
[
|
||||
'family' => 'Beta Serif',
|
||||
'category' => 'serif',
|
||||
'files' => [
|
||||
'regular' => 'https://fonts.gstatic.com/s/beta-regular.woff2',
|
||||
],
|
||||
],
|
||||
],
|
||||
]),
|
||||
'https://fonts.gstatic.com/*' => Http::response('font-binary', 200),
|
||||
]);
|
||||
|
||||
Artisan::call('fonts:sync-google', [
|
||||
'--count' => 2,
|
||||
'--path' => 'storage/app/test-fonts',
|
||||
'--force' => true,
|
||||
]);
|
||||
|
||||
Http::fake([
|
||||
'https://www.googleapis.com/webfonts/v1/webfonts*' => Http::response([
|
||||
'items' => [
|
||||
[
|
||||
'family' => 'Alpha Sans',
|
||||
'category' => 'sans-serif',
|
||||
'files' => [
|
||||
'regular' => 'https://fonts.gstatic.com/s/alpha-regular.woff2',
|
||||
],
|
||||
],
|
||||
[
|
||||
'family' => 'Beta Serif',
|
||||
'category' => 'serif',
|
||||
'files' => [
|
||||
'regular' => 'https://fonts.gstatic.com/s/beta-regular.woff2',
|
||||
],
|
||||
],
|
||||
],
|
||||
]),
|
||||
'https://fonts.gstatic.com/*' => Http::response('font-binary', 200),
|
||||
]);
|
||||
|
||||
Artisan::call('fonts:sync-google', [
|
||||
'--family' => 'Alpha Sans',
|
||||
'--path' => 'storage/app/test-fonts',
|
||||
'--force' => true,
|
||||
]);
|
||||
|
||||
$manifestPath = $targetPath.'/manifest.json';
|
||||
$manifest = json_decode(File::get($manifestPath), true);
|
||||
|
||||
$this->assertSame(2, $manifest['count']);
|
||||
$this->assertCount(2, $manifest['fonts']);
|
||||
$this->assertTrue(collect($manifest['fonts'])->pluck('family')->contains('Alpha Sans'));
|
||||
$this->assertTrue(collect($manifest['fonts'])->pluck('family')->contains('Beta Serif'));
|
||||
|
||||
File::deleteDirectory($targetPath);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user