Skip to content

Commit

Permalink
Update existing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmcclean committed Jan 6, 2025
1 parent 1c99dc9 commit 0783208
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 42 deletions.
11 changes: 11 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
namespace Statamic\Importer\Tests;

use Orchestra\Testbench\Attributes\WithMigration;
use Statamic\Facades\Blueprint;
use Statamic\Facades\Config;
use Statamic\Facades\Fieldset;
use Statamic\Facades\File;
use Statamic\Facades\Site;
use Statamic\Importer\ServiceProvider;
use Statamic\Testing\AddonTestCase;
Expand All @@ -13,6 +16,14 @@ abstract class TestCase extends AddonTestCase
{
protected string $addonServiceProvider = ServiceProvider::class;

protected function setUp(): void
{
parent::setUp();

$this->app['files']->deleteDirectory(Blueprint::directory());
$this->app['files']->deleteDirectory(Fieldset::directory());
}

protected function getEnvironmentSetUp($app)
{
parent::getEnvironmentSetUp($app);
Expand Down
48 changes: 6 additions & 42 deletions tests/Transformers/BardTransformerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,27 +287,15 @@ public function it_enables_buttons_on_bard_field()
config: []
);

$transformer->transform('<p>Hello world!</p>');
$transformer->transform('<h2 style="text-align: center;"><strong>Hello</strong> <em>world</em>!</h2>');

$blueprint = $this->collection->entryBlueprint();

$this->assertEquals([
'h1',
'h2',
'h3',
'aligncenter',
'bold',
'italic',
'unorderedlist',
'orderedlist',
'removeformat',
'quote',
'anchor',
'image',
'table',
'horizontalrule',
'codeblock',
'underline',
'superscript',
], $blueprint->field('content')->get('buttons'));
}

Expand Down Expand Up @@ -337,27 +325,15 @@ public function it_enables_buttons_on_imported_bard_field()
config: []
);

$transformer->transform('<p>Hello world!</p>');
$transformer->transform('<h2 style="text-align: center;"><strong>Hello</strong> <em>world</em>!</h2>');

$fieldset = Fieldset::find('content_stuff');

$this->assertEquals([
'h1',
'h2',
'h3',
'aligncenter',
'bold',
'italic',
'unorderedlist',
'orderedlist',
'removeformat',
'quote',
'anchor',
'image',
'table',
'horizontalrule',
'codeblock',
'underline',
'superscript',
], $fieldset->field('bard_field')->get('buttons'));
}

Expand Down Expand Up @@ -387,27 +363,15 @@ public function it_enables_buttons_on_imported_bard_field_with_prefix()
config: []
);

$transformer->transform('<p>Hello world!</p>');
$transformer->transform('<h2 style="text-align: center;"><strong>Hello</strong> <em>world</em>!</h2>');

$fieldset = Fieldset::find('content_stuff');

$this->assertEquals([
'h1',
'h2',
'h3',
'aligncenter',
'bold',
'italic',
'unorderedlist',
'orderedlist',
'removeformat',
'quote',
'anchor',
'image',
'table',
'horizontalrule',
'codeblock',
'underline',
'superscript',
], $fieldset->field('bard_field')->get('buttons'));
}
}

0 comments on commit 0783208

Please sign in to comment.