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
33 changes: 17 additions & 16 deletions tests/ConfiguratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Tests;

use PHPUnit\Framework\Attributes\Test;
use Statamic\Facades\Path;
use Statamic\Migrator\Configurator;

Expand All @@ -21,7 +22,7 @@ protected function path()
return Path::tidy(config_path('statamic/configurator-test.php'));
}

/** @test */
#[Test]
public function it_normalizes_mangled_indentation_and_ensures_trailing_commas()
{
$this->configurator->normalize();
Expand All @@ -41,7 +42,7 @@ public function it_normalizes_mangled_indentation_and_ensures_trailing_commas()
);
}

/** @test */
#[Test]
public function it_can_set_string_value_to_something_new()
{
$this->assertConfigFileContains(<<<'EOT'
Expand Down Expand Up @@ -70,7 +71,7 @@ public function it_can_set_string_value_to_something_new()
);
}

/** @test */
#[Test]
public function it_can_set_integer_value_to_something_new()
{
$this->assertConfigFileContains(<<<'EOT'
Expand All @@ -86,7 +87,7 @@ public function it_can_set_integer_value_to_something_new()
);
}

/** @test */
#[Test]
public function it_can_set_array_value_to_something_new()
{
$this->assertConfigFileContains(<<<'EOT'
Expand Down Expand Up @@ -123,7 +124,7 @@ public function it_can_set_array_value_to_something_new()
);
}

/** @test */
#[Test]
public function it_can_set_nested_array_value_to_something_new()
{
$this->assertConfigFileContains(<<<'EOT'
Expand Down Expand Up @@ -160,7 +161,7 @@ public function it_can_set_nested_array_value_to_something_new()
);
}

/** @test */
#[Test]
public function it_can_set_completely_new_values()
{
$this->configurator->set('lol', 'catz');
Expand All @@ -187,7 +188,7 @@ public function it_can_set_completely_new_values()
);
}

/** @test */
#[Test]
public function it_doesnt_set_if_falsey_value_is_passed()
{
$this->configurator->set('action', false);
Expand All @@ -200,7 +201,7 @@ public function it_doesnt_set_if_falsey_value_is_passed()
);
}

/** @test */
#[Test]
public function it_does_set_falsey_value_when_explicitly_allowed()
{
$this->configurator->set('action', false, true);
Expand All @@ -225,7 +226,7 @@ public function it_does_set_falsey_value_when_explicitly_allowed()
);
}

/** @test */
#[Test]
public function it_can_merge_into_array()
{
$this->assertConfigFileContains(<<<'EOT'
Expand Down Expand Up @@ -277,7 +278,7 @@ public function it_can_merge_into_array()
);
}

/** @test */
#[Test]
public function it_can_merge_into_nested_array()
{
$this->assertConfigFileContains(<<<'EOT'
Expand All @@ -303,7 +304,7 @@ public function it_can_merge_into_nested_array()
);
}

/** @test */
#[Test]
public function it_can_spaciously_merge_into_array()
{
$this->assertConfigFileContains(<<<'EOT'
Expand Down Expand Up @@ -350,7 +351,7 @@ public function it_can_spaciously_merge_into_array()
);
}

/** @test */
#[Test]
public function it_can_spaciously_merge_into_nested_array()
{
$this->assertConfigFileContains(<<<'EOT'
Expand Down Expand Up @@ -378,7 +379,7 @@ public function it_can_spaciously_merge_into_nested_array()
);
}

/** @test */
#[Test]
public function it_can_spaciously_merge_into_mangled_array()
{
$this->assertConfigFileContains(<<<'EOT'
Expand Down Expand Up @@ -422,7 +423,7 @@ public function it_can_spaciously_merge_into_mangled_array()
);
}

/** @test */
#[Test]
public function it_can_refresh_config()
{
$this->configurator->merge('disks_spacious.local', [
Expand All @@ -436,7 +437,7 @@ public function it_can_refresh_config()
$this->assertEquals('beer', config('statamic.configurator-test.disks_spacious.local.root'));
}

/** @test */
#[Test]
public function it_wont_merge_duplicate_values()
{
$this->assertConfigFileContains(<<<'EOT'
Expand Down Expand Up @@ -513,7 +514,7 @@ public function it_wont_merge_duplicate_values()
);
}

/** @test */
#[Test]
public function it_can_merge_multiple_array_items_with_children()
{
$this->configurator->merge('widgets', [
Expand Down
34 changes: 17 additions & 17 deletions tests/ContentMigratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Tests;

use PHPUnit\Framework\Attributes\Test;
use Statamic\Migrator\ContentMigrator;
use Statamic\Migrator\YAML;

Expand Down Expand Up @@ -48,7 +49,7 @@ private function migrateContent($content)
return ContentMigrator::usingFieldset('speaker')->migrateContent($content);
}

/** @test */
#[Test]
public function it_can_migrate_assets_fields()
{
$content = $this
Expand Down Expand Up @@ -83,7 +84,7 @@ public function it_can_migrate_assets_fields()
$this->assertEquals($expected, $content);
}

/** @test */
#[Test]
public function it_can_migrate_assets_fields_without_container_url()
{
$this->files->put($this->sitePath('content/assets/main.yaml'), 'title: Main');
Expand Down Expand Up @@ -120,7 +121,7 @@ public function it_can_migrate_assets_fields_without_container_url()
$this->assertEquals($expected, $content);
}

/** @test */
#[Test]
public function it_can_migrate_term_fields()
{
$content = $this
Expand Down Expand Up @@ -154,10 +155,9 @@ public function it_can_migrate_term_fields()
}

/**
* @test
*
* @see https://github.com/statamic/cms/issues/3432
**/
*/
#[Test]
public function it_removes_empty_term_fields()
{
$this->withoutExceptionHandling();
Expand Down Expand Up @@ -233,7 +233,7 @@ private function termFields()
];
}

/** @test */
#[Test]
public function it_can_migrate_when_fieldset_has_fields_in_sections()
{
$content = $this
Expand Down Expand Up @@ -274,7 +274,7 @@ public function it_can_migrate_when_fieldset_has_fields_in_sections()
$this->assertEquals($expected, $content);
}

/** @test */
#[Test]
public function it_can_migrate_when_fieldset_has_fields_at_top_level()
{
$content = $this
Expand All @@ -299,7 +299,7 @@ public function it_can_migrate_when_fieldset_has_fields_at_top_level()
$this->assertEquals($expected, $content);
}

/** @test */
#[Test]
public function it_can_migrate_fields_within_replicators()
{
$content = $this
Expand Down Expand Up @@ -377,7 +377,7 @@ public function it_can_migrate_fields_within_replicators()
$this->assertEquals($expected, $content);
}

/** @test */
#[Test]
public function it_can_migrate_fields_within_bards()
{
$content = $this
Expand Down Expand Up @@ -462,7 +462,7 @@ public function it_can_migrate_fields_within_bards()
$this->assertEquals($expected, $content);
}

/** @test */
#[Test]
public function it_can_migrate_fields_within_grids()
{
$content = $this
Expand Down Expand Up @@ -522,7 +522,7 @@ public function it_can_migrate_fields_within_grids()
$this->assertEquals($expected, $content);
}

/** @test */
#[Test]
public function it_can_migrate_fields_within_partials()
{
$content = $this
Expand Down Expand Up @@ -602,7 +602,7 @@ public function it_can_migrate_fields_within_partials()
$this->assertEquals($expected, $content);
}

/** @test */
#[Test]
public function it_can_migrate_bards_with_no_sets()
{
$content = $this
Expand All @@ -629,7 +629,7 @@ public function it_can_migrate_bards_with_no_sets()
$this->assertEquals($expected, $content);
}

/** @test */
#[Test]
public function it_can_migrate_link_it_fields()
{
$content = $this
Expand Down Expand Up @@ -657,7 +657,7 @@ public function it_can_migrate_link_it_fields()
$this->assertEquals($expected, $content);
}

/** @test */
#[Test]
public function it_can_migrate_custom_layout()
{
$content = $this->migrateContent([
Expand All @@ -673,7 +673,7 @@ public function it_can_migrate_custom_layout()
$this->assertEquals($expected, $content);
}

/** @test */
#[Test]
public function it_removes_default_layout()
{
$content = $this->migrateContent([
Expand All @@ -688,7 +688,7 @@ public function it_removes_default_layout()
$this->assertEquals($expected, $content);
}

/** @test */
#[Test]
public function it_removes_custom_default_layout()
{
$this->files->put(base_path('site/settings/theming.yaml'), 'default_layout: custom_default');
Expand Down
Loading