Skip to content

Commit e1422d2

Browse files
authored
Merge pull request #82 from zigzagdev/feature/central-asia
Central Asia
2 parents 06a1b0b + b23daf6 commit e1422d2

14 files changed

Lines changed: 654 additions & 460 deletions

src/app/Packages/Domains/Test/Repository/WorldHeritageRepository_insertManyTest.php

Lines changed: 61 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
namespace App\Packages\Domains\Test\Repository;
44

5+
use Database\Seeders\CountrySeeder;
56
use Tests\TestCase;
67
use App\Packages\Domains\WorldHeritageEntity;
78
use App\Packages\Domains\WorldHeritageEntityCollection;
89
use Illuminate\Support\Facades\DB;
910
use App\Models\WorldHeritage;
1011
use App\Packages\Domains\WorldHeritageRepository;
12+
use App\Models\Country;
1113

1214
class WorldHeritageRepository_insertManyTest extends TestCase
1315
{
@@ -17,6 +19,8 @@ protected function setUp(): void
1719
{
1820
parent::setUp();
1921
$this->refresh();
22+
$seeder = new CountrySeeder();
23+
$seeder->run();
2024
$this->repository = app(WorldHeritageRepository::class);
2125
}
2226

@@ -31,6 +35,8 @@ private function refresh(): void
3135
if (env('APP_ENV') === 'testing') {
3236
DB::connection('mysql')->statement('SET FOREIGN_KEY_CHECKS=0;');
3337
WorldHeritage::truncate();
38+
Country::truncate();
39+
DB::table('site_state_parties')->truncate();
3440
DB::connection('mysql')->statement('SET FOREIGN_KEY_CHECKS=1;');
3541
}
3642
}
@@ -39,88 +45,79 @@ private function arrayData(): array
3945
{
4046
return [
4147
[
42-
'unesco_id' => '660',
43-
'official_name' => 'Buddhist Monuments in the Horyu-ji Area',
44-
'name' => 'Buddhist Monuments in the Horyu-ji Area',
45-
'name_jp' => '法隆寺地域の仏教建造物',
48+
'id' => 1,
49+
'unesco_id' => '668',
50+
'official_name' => 'Historic Monuments of Ancient Nara',
51+
'name' => 'Historic Monuments of Ancient Nara',
52+
'name_jp' => '古都奈良の文化財',
4653
'country' => 'Japan',
4754
'region' => 'Asia',
4855
'state_party' => 'JP',
56+
'state_parties' => ['JP'],
57+
'state_parties_meta' => [
58+
'JP' => ['is_primary' => true, 'inscription_year' => 1998],
59+
],
4960
'category' => 'cultural',
5061
'criteria' => ['ii', 'iii', 'v'],
51-
'year_inscribed' => 1993,
62+
'year_inscribed' => 1998,
5263
'area_hectares' => 442.0,
5364
'buffer_zone_hectares' => 320.0,
5465
'is_endangered' => false,
55-
'latitude' => 34.6147,
56-
'longitude' => 135.7355,
57-
'short_description' => "Early Buddhist wooden structures including the world's oldest wooden building.",
66+
'latitude' => 34.6851,
67+
'longitude' => 135.8048,
68+
'short_description' => 'Temples and shrines of the first permanent capital of Japan.',
5869
'image_url' => '',
59-
'unesco_site_url' => 'https://whc.unesco.org/en/list/660/',
60-
'created_at' => now(), 'updated_at' => now(),
70+
'unesco_site_url' => 'https://whc.unesco.org/en/list/668/',
6171
],
6272
[
63-
'unesco_id' => '661',
64-
'official_name' => 'Himeji-jo',
65-
'name' => 'Himeji-jo',
66-
'name_jp' => '姫路城',
67-
'country' => 'Japan',
68-
'region' => 'Asia',
69-
'state_party' => 'JP',
70-
'category' => 'cultural',
71-
'criteria' => ['ii', 'iii', 'v'],
72-
'year_inscribed' => 1993,
73-
'area_hectares' => 442.0,
74-
'buffer_zone_hectares' => 320.0,
75-
'is_endangered' => false,
76-
'latitude' => 34.8394,
77-
'longitude' => 134.6939,
78-
'short_description' => "A masterpiece of Japanese castle architecture in original form.",
79-
'image_url' => '',
80-
'unesco_site_url' => 'https://whc.unesco.org/en/list/661/',
81-
'created_at' => now(), 'updated_at' => now(),
82-
],
83-
[
84-
'unesco_id' => '662',
85-
'official_name' => 'Yakushima',
86-
'name' => 'Yakushima',
87-
'name_jp' => '屋久島',
73+
'id' => 2,
74+
'unesco_id' => '1234',
75+
'official_name' => 'Example Heritage Site',
76+
'name' => 'Example Heritage Site',
77+
'name_jp' => '例の文化遺産',
8878
'country' => 'Japan',
8979
'region' => 'Asia',
9080
'state_party' => 'JP',
81+
'state_parties' => ['JP'],
82+
'state_parties_meta' => [
83+
'JP' => ['is_primary' => true, 'inscription_year' => 2000],
84+
],
9185
'category' => 'natural',
92-
'criteria' => ['ii', 'iii', 'v'],
93-
'year_inscribed' => 1993,
94-
'area_hectares' => 442.0,
95-
'buffer_zone_hectares' => 320.0,
96-
'is_endangered' => false,
97-
'latitude' => 30.3581,
98-
'longitude' => 130.546,
99-
'short_description' => "A subtropical island with ancient cedar forests and diverse ecosystems.",
86+
'criteria' => ['vii', 'viii'],
87+
'year_inscribed' => 2000,
88+
'area_hectares' => 500.0,
89+
'buffer_zone_hectares' => 400.0,
90+
'is_endangered' => true,
91+
'latitude' => 35.6895,
92+
'longitude' => 139.6917,
93+
'short_description' => 'An example of a natural heritage site.',
10094
'image_url' => '',
101-
'unesco_site_url' => 'https://whc.unesco.org/en/list/662/',
102-
'created_at' => now(), 'updated_at' => now(),
95+
'unesco_site_url' => 'https://whc.unesco.org/en/list/1234/',
10396
],
10497
[
105-
'unesco_id' => '663',
106-
'official_name' => 'Shirakami-Sanchi',
107-
'name' => 'Shirakami-Sanchi',
108-
'name_jp' => '白神山地',
98+
'id' => 3,
99+
'unesco_id' => '669',
100+
'official_name' => 'Shrines and Temples of Nikko',
101+
'name' => 'Shrines and Temples of Nikko',
102+
'name_jp' => '日光の社寺',
109103
'country' => 'Japan',
110104
'region' => 'Asia',
111105
'state_party' => 'JP',
112-
'category' => 'natural',
106+
'state_parties' => ['JP'],
107+
'state_parties_meta' => [
108+
'JP' => ['is_primary' => true, 'inscription_year' => 1999],
109+
],
110+
'category' => 'cultural',
113111
'criteria' => ['ii', 'iii', 'v'],
114-
'year_inscribed' => 1993,
112+
'year_inscribed' => 1999,
115113
'area_hectares' => 442.0,
116114
'buffer_zone_hectares' => 320.0,
117115
'is_endangered' => false,
118-
'latitude' => 40.5167,
119-
'longitude' => 140.05,
120-
'short_description' => "Pristine beech forest with minimal human impact.",
116+
'latitude' => 36.7578,
117+
'longitude' => 139.598,
118+
'short_description' => 'Lavishly decorated shrines set among ancient cedar trees.',
121119
'image_url' => '',
122-
'unesco_site_url' => 'https://whc.unesco.org/en/list/663/',
123-
'created_at' => now(), 'updated_at' => now(),
120+
'unesco_site_url' => 'https://whc.unesco.org/en/list/669/',
124121
],
125122
];
126123
}
@@ -150,7 +147,9 @@ public function test_check_return_type(): void
150147
isset($d['buffer_zone_hectares']) ? (float) $d['buffer_zone_hectares'] : null,
151148
$d['short_description'] ?? null,
152149
$d['image_url'] ?? null,
153-
$d['unesco_site_url'] ?? null
150+
$d['unesco_site_url'] ?? null,
151+
$d['state_parties'] ?? [],
152+
$d['state_parties_meta'] ?? []
154153
);
155154
}, self::arrayData())
156155
);
@@ -182,7 +181,9 @@ public function test_check_return_value(): void
182181
$data['buffer_zone_hectares'],
183182
$data['short_description'],
184183
$data['image_url'],
185-
$data['unesco_site_url']
184+
$data['unesco_site_url'],
185+
$data['state_parties'] ?? [],
186+
$data['state_parties_meta'] ?? []
186187
);
187188
}, self::arrayData())
188189
);
@@ -212,7 +213,8 @@ public function test_check_return_value(): void
212213
$this->assertEquals($value['short_description'], $entity->getShortDescription());
213214
$this->assertEquals($value['image_url'], $entity->getImageUrl());
214215
$this->assertEquals($value['unesco_site_url'], $entity->getUnescoSiteUrl());
215-
216+
$this->assertEquals($value['state_parties'], $entity->getStatePartyCodes());
217+
$this->assertEquals($value['state_parties_meta'], $entity->getStatePartyMeta());
216218
break;
217219
}
218220
}

0 commit comments

Comments
 (0)