Skip to content

Commit 00db901

Browse files
committed
Fix tests in CI
1 parent 9a00a57 commit 00db901

1 file changed

Lines changed: 28 additions & 18 deletions

File tree

tests/integration/TestCase.php

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
use A17\Twill\Commands\Traits\HandlesPresets;
66
use A17\Twill\Models\User;
77
use A17\Twill\RouteServiceProvider;
8-
use A17\Twill\Services\Blocks\Block;
98
use A17\Twill\Tests\Integration\Behaviors\CopyBlocks;
10-
use A17\Twill\Facades\TwillBlocks;
119
use A17\Twill\TwillServiceProvider;
1210
use A17\Twill\ValidationServiceProvider;
1311
use Carbon\Carbon;
@@ -74,6 +72,7 @@ public static function setUpBeforeClass(): void
7472
self::prepareParallelTestbenchApplication();
7573
self::configureParallelDatabase();
7674
cleanupTestState(self::applicationBasePath());
75+
self::copyTestBlockStubs(self::applicationBasePath());
7776
parent::setUpBeforeClass();
7877
}
7978

@@ -138,7 +137,6 @@ public function setUp(): void
138137
$this->instantiateFaker();
139138

140139
$this->copyBlocks();
141-
$this->registerCopiedBlocks();
142140

143141
$this->installTwill();
144142

@@ -561,21 +559,6 @@ public function loadConfig()
561559
{
562560
}
563561

564-
protected function registerCopiedBlocks(): void
565-
{
566-
if (Block::getForComponent('a17-block-quote')) {
567-
return;
568-
}
569-
570-
foreach (config('twill.block_editor.directories.source.blocks') as $path) {
571-
TwillBlocks::registerPackageBlocksDirectory($this->normalizeDir($path['path']));
572-
}
573-
574-
foreach (config('twill.block_editor.directories.source.repeaters') as $path) {
575-
TwillBlocks::registerPackageRepeatersDirectory($this->normalizeDir($path['path']));
576-
}
577-
}
578-
579562
protected static function getBasePathStatic(): string
580563
{
581564
$basePath = __DIR__ . '/../../vendor/orchestra/testbench-core/laravel';
@@ -660,4 +643,31 @@ protected static function copyDirectory(string $source, string $target): void
660643
}
661644
}
662645
}
646+
647+
protected static function copyTestBlockStubs(string $basePath): void
648+
{
649+
$blockPath = $basePath . '/resources/views/twill/blocks';
650+
$repeaterPath = $basePath . '/resources/views/twill/repeaters';
651+
652+
foreach (['carousel', 'footnote', 'gallery', 'image', 'quote'] as $block) {
653+
self::copyTestStub(
654+
__DIR__ . "/../../src/Commands/stubs/blocks/{$block}.blade.php",
655+
"{$blockPath}/{$block}.blade.php"
656+
);
657+
}
658+
659+
self::copyTestStub(
660+
__DIR__ . '/../../src/Commands/stubs/repeaters/carousel-item.blade.php',
661+
"{$repeaterPath}/carousel-item.blade.php"
662+
);
663+
}
664+
665+
protected static function copyTestStub(string $source, string $target): void
666+
{
667+
if (! is_dir(dirname($target))) {
668+
mkdir(dirname($target), 0755, true);
669+
}
670+
671+
copy($source, $target);
672+
}
663673
}

0 commit comments

Comments
 (0)