fix: DockerSecretsResolver - don't normalize absolute paths like /var/www/html/...
Some checks failed
Deploy Application / deploy (push) Has been cancelled
Some checks failed
Deploy Application / deploy (push) Has been cancelled
This commit is contained in:
95
tests/Domain/Cms/Seeds/DefaultContentTypesSeederTest.php
Normal file
95
tests/Domain/Cms/Seeds/DefaultContentTypesSeederTest.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Domain\Cms\Seeds\DefaultContentTypesSeeder;
|
||||
use App\Domain\Cms\Services\ContentTypeService;
|
||||
use App\Framework\Core\PathProvider;
|
||||
|
||||
describe('DefaultContentTypesSeeder', function () {
|
||||
beforeEach(function () {
|
||||
$this->contentTypeService = Mockery::mock(ContentTypeService::class);
|
||||
$this->pathProvider = Mockery::mock(PathProvider::class);
|
||||
$this->seeder = new DefaultContentTypesSeeder($this->contentTypeService, $this->pathProvider);
|
||||
});
|
||||
|
||||
it('has correct name and description', function () {
|
||||
expect($this->seeder->getName())->toBe('DefaultContentTypesSeeder');
|
||||
expect($this->seeder->getDescription())->toContain('default CMS content types');
|
||||
});
|
||||
|
||||
it('creates content types from config', function () {
|
||||
$configPath = Mockery::mock();
|
||||
$configPath->shouldReceive('toString')
|
||||
->once()
|
||||
->andReturn(__DIR__ . '/../../../../config/cms/default-content-types.php');
|
||||
|
||||
$this->pathProvider->shouldReceive('getBasePath')
|
||||
->once()
|
||||
->andReturn(Mockery::mock()->shouldReceive('join')
|
||||
->with('config', 'cms', 'default-content-types.php')
|
||||
->andReturn($configPath)
|
||||
->getMock());
|
||||
|
||||
// Mock that content types don't exist yet
|
||||
$this->contentTypeService->shouldReceive('findBySlug')
|
||||
->with('page')
|
||||
->andThrow(new \RuntimeException('Not found'));
|
||||
|
||||
$this->contentTypeService->shouldReceive('findBySlug')
|
||||
->with('post')
|
||||
->andThrow(new \RuntimeException('Not found'));
|
||||
|
||||
$this->contentTypeService->shouldReceive('findBySlug')
|
||||
->with('landing_page')
|
||||
->andThrow(new \RuntimeException('Not found'));
|
||||
|
||||
// Expect create calls
|
||||
$this->contentTypeService->shouldReceive('create')
|
||||
->once()
|
||||
->with('Page', 'page', 'Standard pages for general content', true);
|
||||
|
||||
$this->contentTypeService->shouldReceive('create')
|
||||
->once()
|
||||
->with('Post', 'post', 'Blog posts and news articles', true);
|
||||
|
||||
$this->contentTypeService->shouldReceive('create')
|
||||
->once()
|
||||
->with('Landing Page', 'landing_page', 'Marketing landing pages for campaigns', true);
|
||||
|
||||
$this->seeder->seed();
|
||||
});
|
||||
|
||||
it('skips existing content types', function () {
|
||||
$configPath = Mockery::mock();
|
||||
$configPath->shouldReceive('toString')
|
||||
->once()
|
||||
->andReturn(__DIR__ . '/../../../../config/cms/default-content-types.php');
|
||||
|
||||
$this->pathProvider->shouldReceive('getBasePath')
|
||||
->once()
|
||||
->andReturn(Mockery::mock()->shouldReceive('join')
|
||||
->with('config', 'cms', 'default-content-types.php')
|
||||
->andReturn($configPath)
|
||||
->getMock());
|
||||
|
||||
// Mock that content types already exist
|
||||
$this->contentTypeService->shouldReceive('findBySlug')
|
||||
->with('page')
|
||||
->andReturn(Mockery::mock());
|
||||
|
||||
$this->contentTypeService->shouldReceive('findBySlug')
|
||||
->with('post')
|
||||
->andReturn(Mockery::mock());
|
||||
|
||||
$this->contentTypeService->shouldReceive('findBySlug')
|
||||
->with('landing_page')
|
||||
->andReturn(Mockery::mock());
|
||||
|
||||
// Should not create anything
|
||||
$this->contentTypeService->shouldNotReceive('create');
|
||||
|
||||
$this->seeder->seed();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user