Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonvarga committed Nov 22, 2024
1 parent fc302ca commit dfe360a
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/ContentMigratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,34 @@ public function it_can_migrate_bards_with_no_sets()
$this->assertEquals($expected, $content);
}

/** @test */
public function it_can_migrate_link_it_fields()
{
$content = $this
->setFields([
'url' => ['type' => 'link_it'],
'asset' => ['type' => 'link_it', 'containers' => ['main']],
'term' => ['type' => 'link_it', 'taxonomies' => ['tags']],
'page' => ['type' => 'link_it'],
])
->migrateContent([
'url' => ['type' => 'url', 'url' => 'http://example.com'],
'asset' => ['type' => 'asset', 'asset' => ['/assets/img/coffee-mug.jpg'], 'container' => 'main'],
'term' => ['type' => 'term', 'term' => ['tags/coffee'], 'taxonomy' => 'tags'],
'page' => ['type' => 'page', 'page' => ['abc']],
]);

$expected = [
'url' => ['type' => 'url', 'url' => 'http://example.com'],
'asset' => ['type' => 'asset', 'asset' => ['main::img/coffee-mug.jpg'], 'container' => 'main'],
'term' => ['type' => 'term', 'term' => ['tags::coffee'], 'taxonomy' => 'tags'],
'page' => ['type' => 'entry', 'entry' => ['abc']],
'blueprint' => 'speaker',
];

$this->assertEquals($expected, $content);
}

/** @test */
public function it_can_migrate_custom_layout()
{
Expand Down
35 changes: 35 additions & 0 deletions tests/MigrateFieldsetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,41 @@ public function it_migrates_date_field()
$this->assertEquals($expected, $fieldset);
}


/** @test */
public function it_migrates_link_it_field()
{
$fieldset = $this->migrateFieldset([
'title' => 'Posts',
'fields' => [
'url' => ['type' => 'link_it'],
'entries' => ['type' => 'link_it', 'collections' => ['blog', 'products']],
],
]);

$expected = [
'title' => 'Posts',
'fields' => [
[
'handle' => 'url',
'field' => [
'type' => 'link_it',
'collections' => ['pages']
],
],
[
'handle' => 'entries',
'field' => [
'type' => 'link_it',
'collections' => ['blog', 'products', 'pages']
],
],
],
];

$this->assertEquals($expected, $fieldset);
}

/** @test */
public function it_migrates_extention_validation()
{
Expand Down

0 comments on commit dfe360a

Please sign in to comment.