-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMigrateLocalizedTaxonomyTest.php
116 lines (94 loc) · 3.18 KB
/
MigrateLocalizedTaxonomyTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
namespace Tests;
use Statamic\Facades\Path;
class MigrateLocalizedTaxonomyTest extends TestCase
{
protected $siteFixture = 'site-localized';
protected function path($append = null)
{
return Path::tidy(collect([base_path('content/taxonomies'), $append])->filter()->implode('/'));
}
/** @test */
public function it_can_migrate_a_taxonomy()
{
$this->assertFileNotExists($this->path('tags'));
$this->assertFileNotExists($this->path('tags.yaml'));
$this->artisan('statamic:migrate:taxonomy', ['handle' => 'tags']);
$this->assertFileExists($this->path('tags.yaml'));
$this->assertCount(4, $this->files->files($this->path('tags')));
}
/** @test */
public function it_migrates_yaml_config()
{
$this->artisan('statamic:migrate:taxonomy', ['handle' => 'tags']);
$expected = [
'sites' => [
'default',
'fr',
],
'title' => 'Tags',
'route' => '/blog/tags/{slug}',
'template' => 'blog/taxonomy',
];
$this->assertParsedYamlEquals($expected, $this->path('tags.yaml'));
}
/** @test */
public function it_can_migrate_a_localized_term()
{
$this->artisan('statamic:migrate:taxonomy', ['handle' => 'tags']);
$expected = [
'title' => 'coffee',
'content' => 'wat',
'thumbnail' => 'img/coffee-mug.jpg',
'blueprint' => 'tag',
'localizations' => [
'fr' => [
'title' => 'le coffvefe',
'content' => 'Le Neato',
'slug' => 'le-coffvefe-les-slug',
],
],
];
$this->assertParsedYamlEquals($expected, $this->path('tags/coffee.yaml'));
}
/** @test */
public function it_can_migrate_a_localized_term_with_partially_filled_content()
{
$this->artisan('statamic:migrate:taxonomy', ['handle' => 'tags']);
$expected = [
'title' => 'harry-potter',
'blueprint' => 'tag',
'localizations' => [
'fr' => [
'title' => 'le-harry-potter',
],
],
];
$this->assertParsedYamlEquals($expected, $this->path('tags/harry-potter.yaml'));
}
/** @test */
public function it_can_migrate_a_term_without_localized_content()
{
$this->artisan('statamic:migrate:taxonomy', ['handle' => 'tags']);
$expected = [
'title' => 'spring',
'blueprint' => 'tag',
];
$this->assertParsedYamlEquals($expected, $this->path('tags/spring.yaml'));
}
/** @test */
public function it_can_migrate_a_localized_term_without_default_site_content()
{
$this->artisan('statamic:migrate:taxonomy', ['handle' => 'tags']);
$expected = [
'title' => 'smells',
'blueprint' => 'tag',
'localizations' => [
'fr' => [
'title' => 'la smells',
],
],
];
$this->assertParsedYamlEquals($expected, $this->path('tags/smells.yaml'));
}
}