Skip to content

Commit dfe360a

Browse files
committed
tests
1 parent fc302ca commit dfe360a

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

tests/ContentMigratorTest.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,34 @@ public function it_can_migrate_bards_with_no_sets()
629629
$this->assertEquals($expected, $content);
630630
}
631631

632+
/** @test */
633+
public function it_can_migrate_link_it_fields()
634+
{
635+
$content = $this
636+
->setFields([
637+
'url' => ['type' => 'link_it'],
638+
'asset' => ['type' => 'link_it', 'containers' => ['main']],
639+
'term' => ['type' => 'link_it', 'taxonomies' => ['tags']],
640+
'page' => ['type' => 'link_it'],
641+
])
642+
->migrateContent([
643+
'url' => ['type' => 'url', 'url' => 'http://example.com'],
644+
'asset' => ['type' => 'asset', 'asset' => ['/assets/img/coffee-mug.jpg'], 'container' => 'main'],
645+
'term' => ['type' => 'term', 'term' => ['tags/coffee'], 'taxonomy' => 'tags'],
646+
'page' => ['type' => 'page', 'page' => ['abc']],
647+
]);
648+
649+
$expected = [
650+
'url' => ['type' => 'url', 'url' => 'http://example.com'],
651+
'asset' => ['type' => 'asset', 'asset' => ['main::img/coffee-mug.jpg'], 'container' => 'main'],
652+
'term' => ['type' => 'term', 'term' => ['tags::coffee'], 'taxonomy' => 'tags'],
653+
'page' => ['type' => 'entry', 'entry' => ['abc']],
654+
'blueprint' => 'speaker',
655+
];
656+
657+
$this->assertEquals($expected, $content);
658+
}
659+
632660
/** @test */
633661
public function it_can_migrate_custom_layout()
634662
{

tests/MigrateFieldsetTest.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,41 @@ public function it_migrates_date_field()
795795
$this->assertEquals($expected, $fieldset);
796796
}
797797

798+
799+
/** @test */
800+
public function it_migrates_link_it_field()
801+
{
802+
$fieldset = $this->migrateFieldset([
803+
'title' => 'Posts',
804+
'fields' => [
805+
'url' => ['type' => 'link_it'],
806+
'entries' => ['type' => 'link_it', 'collections' => ['blog', 'products']],
807+
],
808+
]);
809+
810+
$expected = [
811+
'title' => 'Posts',
812+
'fields' => [
813+
[
814+
'handle' => 'url',
815+
'field' => [
816+
'type' => 'link_it',
817+
'collections' => ['pages']
818+
],
819+
],
820+
[
821+
'handle' => 'entries',
822+
'field' => [
823+
'type' => 'link_it',
824+
'collections' => ['blog', 'products', 'pages']
825+
],
826+
],
827+
],
828+
];
829+
830+
$this->assertEquals($expected, $fieldset);
831+
}
832+
798833
/** @test */
799834
public function it_migrates_extention_validation()
800835
{

0 commit comments

Comments
 (0)