events werden nun erfolgreich gespeichert, branding wird nun erfolgreich gespeichert, emotionen können nun angelegt werden. Task Ansicht im Event admin verbessert, Buttons in FAB umgewandelt und vereinheitlicht. Teilen-Link Guest PWA schicker gemacht, SynGoogleFonts ausgebaut (mit Einzel-Family-Download).
This commit is contained in:
@@ -72,5 +72,121 @@ class SyncGoogleFontsTest extends TestCase
|
||||
|
||||
File::deleteDirectory($targetPath);
|
||||
}
|
||||
}
|
||||
|
||||
public function test_it_filters_by_category(): 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' => 5,
|
||||
'--category' => 'serif',
|
||||
'--path' => 'storage/app/test-fonts',
|
||||
'--force' => true,
|
||||
]);
|
||||
|
||||
$manifestPath = $targetPath.'/manifest.json';
|
||||
$manifest = json_decode(File::get($manifestPath), true);
|
||||
|
||||
$this->assertSame(1, $manifest['count']);
|
||||
$this->assertSame('Beta Serif', $manifest['fonts'][0]['family']);
|
||||
|
||||
File::deleteDirectory($targetPath);
|
||||
}
|
||||
|
||||
public function test_dry_run_does_not_write_files_or_download_fonts(): 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',
|
||||
],
|
||||
],
|
||||
],
|
||||
]),
|
||||
'https://fonts.gstatic.com/*' => function () {
|
||||
$this->fail('Font files should not be requested during dry run.');
|
||||
},
|
||||
]);
|
||||
|
||||
Artisan::call('fonts:sync-google', [
|
||||
'--count' => 1,
|
||||
'--path' => 'storage/app/test-fonts',
|
||||
'--dry-run' => true,
|
||||
]);
|
||||
|
||||
$this->assertDirectoryDoesNotExist($targetPath);
|
||||
}
|
||||
|
||||
public function test_it_downloads_specific_family_even_when_count_is_smaller(): 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' => 1,
|
||||
'--family' => 'Beta Serif',
|
||||
'--path' => 'storage/app/test-fonts',
|
||||
'--force' => true,
|
||||
]);
|
||||
|
||||
$manifestPath = $targetPath.'/manifest.json';
|
||||
$manifest = json_decode(File::get($manifestPath), true);
|
||||
|
||||
$this->assertSame(1, $manifest['count']);
|
||||
$this->assertSame('Beta Serif', $manifest['fonts'][0]['family']);
|
||||
|
||||
File::deleteDirectory($targetPath);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user