22
33namespace App \Packages \Features \Tests ;
44
5+ use App \Models \Country ;
56use App \Models \WorldHeritage ;
7+ use Database \Seeders \CountrySeeder ;
68use Illuminate \Support \Facades \DB ;
79use Tests \TestCase ;
810
@@ -12,6 +14,8 @@ protected function setUp(): void
1214 {
1315 parent ::setUp ();
1416 $ this ->refresh ();
17+ $ seeder = new CountrySeeder ();
18+ $ seeder ->run ();
1519 }
1620
1721 protected function tearDown (): void
@@ -25,6 +29,8 @@ private function refresh(): void
2529 if (env ('APP_ENV ' ) === 'testing ' ) {
2630 DB ::connection ('mysql ' )->statement ('SET FOREIGN_KEY_CHECKS=0; ' );
2731 WorldHeritage::truncate ();
32+ Country::truncate ();
33+ DB ::table ('site_state_parties ' )->truncate ();
2834 DB ::connection ('mysql ' )->statement ('SET FOREIGN_KEY_CHECKS=1; ' );
2935 }
3036 }
@@ -33,89 +39,80 @@ private static function arrayData(): array
3339 {
3440 return [
3541 [
36- 'unesco_id ' => '660 ' ,
37- 'official_name ' => 'Buddhist Monuments in the Horyu-ji Area ' ,
38- 'name ' => 'Buddhist Monuments in the Horyu-ji Area ' ,
39- 'name_jp ' => '法隆寺地域の仏教建造物 ' ,
40- 'country ' => 'Japan ' ,
41- 'region ' => 'Asia ' ,
42- 'state_party ' => 'JP ' ,
43- 'category ' => 'cultural ' ,
44- 'criteria ' => ['ii ' , 'iii ' , 'v ' ],
45- 'year_inscribed ' => 1993 ,
46- 'area_hectares ' => 442.0 ,
47- 'buffer_zone_hectares ' => 320.0 ,
42+ 'id ' => 1 ,
43+ 'unesco_id ' => '1133 ' ,
44+ 'official_name ' => "Ancient and Primeval Beech Forests of the Carpathians and Other Regions of Europe " ,
45+ 'name ' => "Ancient and Primeval Beech Forests " ,
46+ 'name_jp ' => null ,
47+ 'country ' => 'Slovakia ' ,
48+ 'region ' => 'Europe ' ,
49+ 'category ' => 'natural ' ,
50+ 'criteria ' => ['ix ' ],
51+ 'state_party ' => null ,
52+ 'year_inscribed ' => 2007 ,
53+ 'area_hectares ' => 99947.81 ,
54+ 'buffer_zone_hectares ' => 296275.8 ,
4855 'is_endangered ' => false ,
49- 'latitude ' => 34.6147 ,
50- 'longitude ' => 135.7355 ,
51- 'short_description ' => " Early Buddhist wooden structures including the world's oldest wooden building. " ,
56+ 'latitude ' => 0.0 ,
57+ 'longitude ' => 0.0 ,
58+ 'short_description ' => ' Transnational serial property of European beech forests illustrating post-glacial expansion and ecological processes across Europe. ' ,
5259 'image_url ' => '' ,
53- 'unesco_site_url ' => 'https://whc.unesco.org/en/list/660/ ' ,
60+ 'unesco_site_url ' => 'https://whc.unesco.org/en/list/1133/ ' ,
61+ 'state_parties ' => [
62+ 'AL ' ,'AT ' ,'BE ' ,'BA ' ,'BG ' ,'HR ' ,'CZ ' ,'FR ' ,'DE ' ,'IT ' ,'MK ' ,'PL ' ,'RO ' ,'SK ' ,'SI ' ,'ES ' ,'CH ' ,'UA '
63+ ],
64+ 'state_parties_meta ' => [
65+ 'AL ' => ['is_primary ' => false , 'inscription_year ' => 2007 ],
66+ 'AT ' => ['is_primary ' => false , 'inscription_year ' => 2007 ],
67+ 'BE ' => ['is_primary ' => false , 'inscription_year ' => 2007 ],
68+ 'BA ' => ['is_primary ' => false , 'inscription_year ' => 2007 ],
69+ 'BG ' => ['is_primary ' => false , 'inscription_year ' => 2007 ],
70+ 'HR ' => ['is_primary ' => false , 'inscription_year ' => 2007 ],
71+ 'CZ ' => ['is_primary ' => false , 'inscription_year ' => 2007 ],
72+ 'FR ' => ['is_primary ' => false , 'inscription_year ' => 2007 ],
73+ 'DE ' => ['is_primary ' => false , 'inscription_year ' => 2007 ],
74+ 'IT ' => ['is_primary ' => false , 'inscription_year ' => 2007 ],
75+ 'MK ' => ['is_primary ' => false , 'inscription_year ' => 2007 ],
76+ 'PL ' => ['is_primary ' => false , 'inscription_year ' => 2007 ],
77+ 'RO ' => ['is_primary ' => false , 'inscription_year ' => 2007 ],
78+ 'SK ' => ['is_primary ' => true , 'inscription_year ' => 2007 ],
79+ 'SI ' => ['is_primary ' => false , 'inscription_year ' => 2007 ],
80+ 'ES ' => ['is_primary ' => false , 'inscription_year ' => 2007 ],
81+ 'CH ' => ['is_primary ' => false , 'inscription_year ' => 2007 ],
82+ 'UA ' => ['is_primary ' => false , 'inscription_year ' => 2007 ],
83+ ],
5484 ],
5585 [
56- 'unesco_id ' => '661 ' ,
57- 'official_name ' => 'Himeji-jo ' ,
58- 'name ' => 'Himeji-jo ' ,
59- 'name_jp ' => '姫路城 ' ,
60- 'country ' => 'Japan ' ,
86+ 'id ' => 2 ,
87+ 'unesco_id ' => '1442 ' ,
88+ 'official_name ' => "Silk Roads: the Routes Network of Chang'an-Tianshan Corridor " ,
89+ 'name ' => "Silk Roads: Chang'an–Tianshan Corridor " ,
90+ 'name_jp ' => 'シルクロード:長安-天山回廊の交易路網 ' ,
91+ 'country ' => 'China, Kazakhstan, Kyrgyzstan ' ,
6192 'region ' => 'Asia ' ,
62- 'state_party ' => 'JP ' ,
6393 'category ' => 'cultural ' ,
64- 'criteria ' => ['ii ' , 'iii ' , 'v ' ],
65- 'year_inscribed ' => 1993 ,
66- 'area_hectares ' => 442.0 ,
67- 'buffer_zone_hectares ' => 320.0 ,
68- 'is_endangered ' => false ,
69- 'latitude ' => 34.8394 ,
70- 'longitude ' => 134.6939 ,
71- 'short_description ' => "A masterpiece of Japanese castle architecture in original form. " ,
72- 'image_url ' => '' ,
73- 'unesco_site_url ' => 'https://whc.unesco.org/en/list/661/ ' ,
74- ],
75- [
76- 'unesco_id ' => '662 ' ,
77- 'official_name ' => 'Yakushima ' ,
78- 'name ' => 'Yakushima ' ,
79- 'name_jp ' => '屋久島 ' ,
80- 'country ' => 'Japan ' ,
81- 'region ' => 'Asia ' ,
82- 'state_party ' => 'JP ' ,
83- 'category ' => 'natural ' ,
84- 'criteria ' => ['ii ' , 'iii ' , 'v ' ],
85- 'year_inscribed ' => 1993 ,
86- 'area_hectares ' => 442.0 ,
87- 'buffer_zone_hectares ' => 320.0 ,
94+ 'criteria ' => ['ii ' ,'iii ' ,'vi ' ],
95+ 'state_party ' => null ,
96+ 'year_inscribed ' => 2014 ,
97+ 'area_hectares ' => 0.0 ,
98+ 'buffer_zone_hectares ' => 0.0 ,
8899 'is_endangered ' => false ,
89- 'latitude ' => 30.3581 ,
90- 'longitude ' => 130.546 ,
91- 'short_description ' => " A subtropical island with ancient cedar forests and diverse ecosystems. " ,
100+ 'latitude ' => 0.0 ,
101+ 'longitude ' => 0.0 ,
102+ 'short_description ' => ' Transnational Silk Road corridor across China, Kazakhstan and Kyrgyzstan illustrating exchange of goods, ideas and beliefs. ' ,
92103 'image_url ' => '' ,
93- 'unesco_site_url ' => 'https://whc.unesco.org/en/list/662/ ' ,
104+ 'unesco_site_url ' => 'https://whc.unesco.org/en/list/1442/ ' ,
105+ 'state_parties ' => ['CN ' ,'KZ ' ,'KG ' ],
106+ 'state_parties_meta ' => [
107+ 'CN ' => ['is_primary ' => true , 'inscription_year ' => 2014 ],
108+ 'KZ ' => ['is_primary ' => false , 'inscription_year ' => 2014 ],
109+ 'KG ' => ['is_primary ' => false , 'inscription_year ' => 2014 ],
110+ ],
94111 ],
95- [
96- 'unesco_id ' => '663 ' ,
97- 'official_name ' => 'Shirakami-Sanchi ' ,
98- 'name ' => 'Shirakami-Sanchi ' ,
99- 'name_jp ' => '白神山地 ' ,
100- 'country ' => 'Japan ' ,
101- 'region ' => 'Asia ' ,
102- 'state_party ' => 'JP ' ,
103- 'category ' => 'natural ' ,
104- 'criteria ' => ['ii ' , 'iii ' , 'v ' ],
105- 'year_inscribed ' => 1993 ,
106- 'area_hectares ' => 442.0 ,
107- 'buffer_zone_hectares ' => 320.0 ,
108- 'is_endangered ' => false ,
109- 'latitude ' => 40.5167 ,
110- 'longitude ' => 140.05 ,
111- 'short_description ' => "Pristine beech forest with minimal human impact. " ,
112- 'image_url ' => '' ,
113- 'unesco_site_url ' => 'https://whc.unesco.org/en/list/663/ ' ,
114- ]
115112 ];
116113 }
117114
118- public function test_feature (): void
115+ public function test_feature_check (): void
119116 {
120117 $ result = $ this ->postJson ('/api/v1/heritages ' , self ::arrayData ());
121118
@@ -142,6 +139,8 @@ public function test_feature(): void
142139 'short_description ' ,
143140 'image_url ' ,
144141 'unesco_site_url ' ,
142+ 'state_party_codes ' ,
143+ 'state_parties_meta ' ,
145144 ]
146145 ]
147146 ]);
0 commit comments