Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions tests/Commands/ImportAssetsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Facade;
use PHPUnit\Framework\Attributes\Test;
use Statamic\Contracts\Assets\Asset as AssetContract;
use Statamic\Contracts\Assets\AssetContainer as AssetContainerContract;
use Statamic\Contracts\Assets\AssetContainerRepository as AssetContainerRepositoryContract;
Expand Down Expand Up @@ -45,7 +46,7 @@ public function tearDown(): void
parent::tearDown();
}

/** @test */
#[Test]
public function it_imports_asset_containers_and_assets()
{
$container = tap(AssetContainer::make('test')->disk('test'))->save();
Expand All @@ -72,7 +73,7 @@ public function it_imports_asset_containers_and_assets()
$this->assertDatabaseHas('assets_meta', ['container' => 'test', 'path' => 'subdirectory/other.txt']);
}

/** @test */
#[Test]
public function it_imports_asset_containers_and_assets_with_force_argument()
{
$container = tap(AssetContainer::make('test')->disk('test'))->save();
Expand All @@ -97,7 +98,7 @@ public function it_imports_asset_containers_and_assets_with_force_argument()
$this->assertDatabaseHas('assets_meta', ['container' => 'test', 'path' => 'subdirectory/other.txt']);
}

/** @test */
#[Test]
public function it_imports_asset_containers_with_only_asset_containers_argument()
{
$container = tap(AssetContainer::make('test')->disk('test'))->save();
Expand All @@ -122,7 +123,7 @@ public function it_imports_asset_containers_with_only_asset_containers_argument(
$this->assertDatabaseMissing('assets_meta', ['container' => 'test', 'path' => 'subdirectory/other.txt']);
}

/** @test */
#[Test]
public function it_imports_asset_containers_with_console_question()
{
$container = tap(AssetContainer::make('test')->disk('test'))->save();
Expand All @@ -149,7 +150,7 @@ public function it_imports_asset_containers_with_console_question()
$this->assertDatabaseMissing('assets_meta', ['container' => 'test', 'path' => 'subdirectory/other.txt']);
}

/** @test */
#[Test]
public function it_imports_assets_with_only_assets_argument()
{
$container = tap(AssetContainer::make('test')->disk('test'))->save();
Expand All @@ -174,7 +175,7 @@ public function it_imports_assets_with_only_assets_argument()
$this->assertDatabaseHas('assets_meta', ['container' => 'test', 'path' => 'subdirectory/other.txt']);
}

/** @test */
#[Test]
public function it_imports_assets_with_console_question()
{
$container = tap(AssetContainer::make('test')->disk('test'))->save();
Expand Down
13 changes: 7 additions & 6 deletions tests/Commands/ImportBlueprintsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Tests\Commands;

use Illuminate\Support\Facades\Facade;
use PHPUnit\Framework\Attributes\Test;
use Statamic\Eloquent\Fields\BlueprintModel;
use Statamic\Eloquent\Fields\FieldsetModel;
use Statamic\Facades\Blueprint as BlueprintFacade;
Expand Down Expand Up @@ -44,7 +45,7 @@ public function setUp(): void
File::withAbsolutePaths()->getFilesByTypeRecursively(resource_path('fieldsets'), 'yaml')->each(fn ($file) => unlink($file));
}

/** @test */
#[Test]
public function it_imports_blueprints_and_fieldsets()
{
BlueprintFacade::make('user')->setContents([
Expand Down Expand Up @@ -75,7 +76,7 @@ public function it_imports_blueprints_and_fieldsets()
$this->assertCount(1, FieldsetModel::all());
}

/** @test */
#[Test]
public function it_imports_blueprints_with_console_question()
{
BlueprintFacade::make('user')->setContents([
Expand Down Expand Up @@ -105,7 +106,7 @@ public function it_imports_blueprints_with_console_question()
$this->assertCount(0, FieldsetModel::all());
}

/** @test */
#[Test]
public function it_imports_fieldsets_with_console_question()
{
BlueprintFacade::make('user')->setContents([
Expand Down Expand Up @@ -135,7 +136,7 @@ public function it_imports_fieldsets_with_console_question()
$this->assertCount(1, FieldsetModel::all());
}

/** @test */
#[Test]
public function it_imports_blueprints_with_only_blueprints_argument()
{
BlueprintFacade::make('user')->setContents([
Expand Down Expand Up @@ -163,7 +164,7 @@ public function it_imports_blueprints_with_only_blueprints_argument()
$this->assertCount(0, FieldsetModel::all());
}

/** @test */
#[Test]
public function it_imports_fieldsets_with_only_fieldsets_argument()
{
BlueprintFacade::make('user')->setContents([
Expand Down Expand Up @@ -191,7 +192,7 @@ public function it_imports_fieldsets_with_only_fieldsets_argument()
$this->assertCount(1, FieldsetModel::all());
}

/** @test */
#[Test]
public function it_imports_blueprints_and_fieldsets_with_force_argument()
{
BlueprintFacade::make('user')->setContents([
Expand Down
13 changes: 7 additions & 6 deletions tests/Commands/ImportCollectionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Tests\Commands;

use Illuminate\Support\Facades\Facade;
use PHPUnit\Framework\Attributes\Test;
use Statamic\Contracts\Entries\Collection as CollectionContract;
use Statamic\Contracts\Entries\CollectionRepository as CollectionRepositoryContract;
use Statamic\Contracts\Entries\Entry as EntryContract;
Expand Down Expand Up @@ -37,7 +38,7 @@ public function setUp(): void
app()->bind(EntryContract::class, \Statamic\Entries\Entry::class);
}

/** @test */
#[Test]
public function it_imports_collections_and_collection_trees()
{
$collection = tap(Collection::make('pages')->title('Pages'))->save();
Expand Down Expand Up @@ -67,7 +68,7 @@ public function it_imports_collections_and_collection_trees()
$this->assertDatabaseHas('trees', ['handle' => 'pages', 'type' => 'collection']);
}

/** @test */
#[Test]
public function it_imports_collections_and_collection_trees_with_force_argument()
{
$collection = tap(Collection::make('pages')->title('Pages'))->save();
Expand Down Expand Up @@ -95,7 +96,7 @@ public function it_imports_collections_and_collection_trees_with_force_argument(
$this->assertDatabaseHas('trees', ['handle' => 'pages', 'type' => 'collection']);
}

/** @test */
#[Test]
public function it_imports_collections_with_console_question()
{
$collection = tap(Collection::make('pages')->title('Pages'))->save();
Expand Down Expand Up @@ -125,7 +126,7 @@ public function it_imports_collections_with_console_question()
$this->assertDatabaseMissing('trees', ['handle' => 'pages', 'type' => 'collection']);
}

/** @test */
#[Test]
public function it_imports_collections_with_only_collections_argument()
{
$collection = tap(Collection::make('pages')->title('Pages'))->save();
Expand Down Expand Up @@ -153,7 +154,7 @@ public function it_imports_collections_with_only_collections_argument()
$this->assertDatabaseMissing('trees', ['handle' => 'pages', 'type' => 'collection']);
}

/** @test */
#[Test]
public function it_imports_collection_trees_with_console_question()
{
$collection = tap(Collection::make('pages')->title('Pages'))->save();
Expand Down Expand Up @@ -183,7 +184,7 @@ public function it_imports_collection_trees_with_console_question()
$this->assertDatabaseHas('trees', ['handle' => 'pages', 'type' => 'collection']);
}

/** @test */
#[Test]
public function it_imports_collection_trees_with_only_collections_argument()
{
$collection = tap(Collection::make('pages')->title('Pages'))->save();
Expand Down
5 changes: 3 additions & 2 deletions tests/Commands/ImportEntriesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Tests\Commands;

use Illuminate\Support\Facades\Facade;
use PHPUnit\Framework\Attributes\Test;
use Statamic\Contracts\Entries\Collection as CollectionContract;
use Statamic\Contracts\Entries\CollectionRepository as CollectionRepositoryContract;
use Statamic\Contracts\Entries\Entry as EntryContract;
Expand Down Expand Up @@ -38,7 +39,7 @@ public function setUp(): void
app()->bind(EntryContract::class, \Statamic\Entries\Entry::class);
}

/** @test */
#[Test]
public function it_imports_entries()
{
$collection = tap(Collection::make('pages')->title('Pages'))->save();
Expand All @@ -55,7 +56,7 @@ public function it_imports_entries()
$this->assertDatabaseHas('entries', ['collection' => 'pages', 'slug' => 'foo', 'data' => '{"foo":"bar"}']);
}

/** @test */
#[Test]
public function it_imports_localized_entries()
{
Site::setSites([
Expand Down
13 changes: 7 additions & 6 deletions tests/Commands/ImportFormsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Tests\Commands;

use Illuminate\Support\Facades\Facade;
use PHPUnit\Framework\Attributes\Test;
use Statamic\Contracts\Forms\Form as FormContract;
use Statamic\Contracts\Forms\FormRepository as FormRepositoryContract;
use Statamic\Contracts\Forms\Submission as SubmissionContract;
Expand Down Expand Up @@ -31,7 +32,7 @@ public function setUp(): void
app()->bind(\Statamic\Eloquent\Forms\SubmissionQueryBuilder::class, \Statamic\Stache\Query\SubmissionQueryBuilder::class);
}

/** @test */
#[Test]
public function it_imports_forms_and_submissions()
{
$form = tap(Form::make('contact')->title('Contact')->store(true))->save();
Expand All @@ -57,7 +58,7 @@ public function it_imports_forms_and_submissions()
$this->assertDatabaseHas('form_submissions', ['form' => 'contact', 'data' => '{"name":"Jesse"}']);
}

/** @test */
#[Test]
public function it_imports_forms_and_submissions_with_force_argument()
{
$form = tap(Form::make('contact')->title('Contact')->store(true))->save();
Expand All @@ -81,7 +82,7 @@ public function it_imports_forms_and_submissions_with_force_argument()
$this->assertDatabaseHas('form_submissions', ['form' => 'contact', 'data' => '{"name":"Jesse"}']);
}

/** @test */
#[Test]
public function it_imports_only_forms_with_only_forms_argument()
{
$form = tap(Form::make('contact')->title('Contact')->store(true))->save();
Expand All @@ -105,7 +106,7 @@ public function it_imports_only_forms_with_only_forms_argument()
$this->assertDatabaseMissing('form_submissions', ['form' => 'contact', 'data' => '{"name":"Jesse"}']);
}

/** @test */
#[Test]
public function it_imports_only_forms_with_console_question()
{
$form = tap(\Statamic\Facades\Form::make('contact')->title('Contact')->store(true))->save();
Expand All @@ -131,7 +132,7 @@ public function it_imports_only_forms_with_console_question()
$this->assertDatabaseMissing('form_submissions', ['form' => 'contact', 'data' => '{"name":"Jesse"}']);
}

/** @test */
#[Test]
public function it_imports_only_submissions_with_only_form_submissions_argument()
{
$form = tap(Form::make('contact')->title('Contact')->store(true))->save();
Expand All @@ -155,7 +156,7 @@ public function it_imports_only_submissions_with_only_form_submissions_argument(
$this->assertDatabaseHas('form_submissions', ['form' => 'contact', 'data' => '{"name":"Jesse"}']);
}

/** @test */
#[Test]
public function it_imports_only_form_submissions_with_console_question()
{
$form = tap(\Statamic\Facades\Form::make('contact')->title('Contact')->store(true))->save();
Expand Down
13 changes: 7 additions & 6 deletions tests/Commands/ImportGlobalsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Tests\Commands;

use Illuminate\Support\Facades\Facade;
use PHPUnit\Framework\Attributes\Test;
use Statamic\Contracts\Globals\GlobalRepository as GlobalRepositoryContract;
use Statamic\Contracts\Globals\GlobalSet as GlobalSetContract;
use Statamic\Contracts\Globals\GlobalVariablesRepository as GlobalVariablesRepositoryContract;
Expand Down Expand Up @@ -30,7 +31,7 @@ public function setUp(): void
app()->bind(GlobalVariablesRepositoryContract::class, \Statamic\Stache\Repositories\GlobalVariablesRepository::class);
}

/** @test */
#[Test]
public function it_imports_global_sets_and_variables()
{
$globalSet = tap(GlobalSet::make('footer')->title('Footer'))->save();
Expand All @@ -53,7 +54,7 @@ public function it_imports_global_sets_and_variables()
$this->assertDatabaseHas('global_set_variables', ['handle' => 'footer', 'locale' => 'en', 'data' => '{"foo":"bar"}']);
}

/** @test */
#[Test]
public function it_imports_global_sets_and_variables_with_force_argument()
{
$globalSet = tap(GlobalSet::make('footer')->title('Footer'))->save();
Expand All @@ -74,7 +75,7 @@ public function it_imports_global_sets_and_variables_with_force_argument()
$this->assertDatabaseHas('global_set_variables', ['handle' => 'footer', 'locale' => 'en', 'data' => '{"foo":"bar"}']);
}

/** @test */
#[Test]
public function it_imports_only_global_sets_with_console_question()
{
$globalSet = tap(GlobalSet::make('footer')->title('Footer'))->save();
Expand All @@ -97,7 +98,7 @@ public function it_imports_only_global_sets_with_console_question()
$this->assertDatabaseMissing('global_set_variables', ['handle' => 'footer', 'locale' => 'en', 'data' => '{"foo":"bar"}']);
}

/** @test */
#[Test]
public function it_imports_only_global_sets_with_only_global_sets_argument()
{
$globalSet = tap(GlobalSet::make('footer')->title('Footer'))->save();
Expand All @@ -118,7 +119,7 @@ public function it_imports_only_global_sets_with_only_global_sets_argument()
$this->assertDatabaseMissing('global_set_variables', ['handle' => 'footer', 'locale' => 'en', 'data' => '{"foo":"bar"}']);
}

/** @test */
#[Test]
public function it_imports_only_variables_with_console_question()
{
$globalSet = tap(GlobalSet::make('footer')->title('Footer'))->save();
Expand All @@ -141,7 +142,7 @@ public function it_imports_only_variables_with_console_question()
$this->assertDatabaseHas('global_set_variables', ['handle' => 'footer', 'locale' => 'en', 'data' => '{"foo":"bar"}']);
}

/** @test */
#[Test]
public function it_imports_only_variables_with_only_global_variables_argument()
{
$globalSet = tap(GlobalSet::make('footer')->title('Footer'))->save();
Expand Down
13 changes: 7 additions & 6 deletions tests/Commands/ImportNavsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Tests\Commands;

use Illuminate\Support\Facades\Facade;
use PHPUnit\Framework\Attributes\Test;
use Statamic\Contracts\Structures\Nav as NavContract;
use Statamic\Contracts\Structures\NavigationRepository as NavigationRepositoryContract;
use Statamic\Contracts\Structures\NavTree as NavTreeContract;
Expand Down Expand Up @@ -30,7 +31,7 @@ public function setUp(): void
app()->bind(NavTreeRepositoryContract::class, \Statamic\Stache\Repositories\NavTreeRepository::class);
}

/** @test */
#[Test]
public function it_imports_navs_and_nav_trees()
{
$nav = tap(Nav::make('footer')->title('Footer'))->save();
Expand All @@ -55,7 +56,7 @@ public function it_imports_navs_and_nav_trees()
$this->assertDatabaseHas('trees', ['handle' => 'footer', 'type' => 'navigation']);
}

/** @test */
#[Test]
public function it_imports_navs_and_nav_trees_with_force_argument()
{
$nav = tap(Nav::make('footer')->title('Footer'))->save();
Expand All @@ -78,7 +79,7 @@ public function it_imports_navs_and_nav_trees_with_force_argument()
$this->assertDatabaseHas('trees', ['handle' => 'footer', 'type' => 'navigation']);
}

/** @test */
#[Test]
public function it_imports_navs_with_console_question()
{
$nav = tap(Nav::make('footer')->title('Footer'))->save();
Expand All @@ -103,7 +104,7 @@ public function it_imports_navs_with_console_question()
$this->assertDatabaseMissing('trees', ['handle' => 'footer', 'type' => 'navigation']);
}

/** @test */
#[Test]
public function it_imports_navs_with_only_navs_argument()
{
$nav = tap(Nav::make('footer')->title('Footer'))->save();
Expand All @@ -126,7 +127,7 @@ public function it_imports_navs_with_only_navs_argument()
$this->assertDatabaseMissing('trees', ['handle' => 'footer', 'type' => 'navigation']);
}

/** @test */
#[Test]
public function it_imports_nav_trees_with_console_question()
{
$nav = tap(Nav::make('footer')->title('Footer'))->save();
Expand All @@ -151,7 +152,7 @@ public function it_imports_nav_trees_with_console_question()
$this->assertDatabaseHas('trees', ['handle' => 'footer', 'type' => 'navigation']);
}

/** @test */
#[Test]
public function it_imports_nav_trees_with_only_nav_trees_argument()
{
$nav = tap(Nav::make('footer')->title('Footer'))->save();
Expand Down
Loading