File tree Expand file tree Collapse file tree 1 file changed +66
-0
lines changed
backend/tests/Unit/Infrastructures/Queries/Dns Expand file tree Collapse file tree 1 file changed +66
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Tests \Unit \Infrastructures \Queries \Dns ;
6+
7+ use App \Infrastructures \Models \DnsRecordType ;
8+ use App \Infrastructures \Queries \Dns \EloquentDnsRecordTypeQueryService ;
9+ use Illuminate \Foundation \Testing \RefreshDatabase ;
10+ use Tests \TestCase ;
11+
12+ final class EloquentDnsQueryServiceTest extends TestCase
13+ {
14+ use RefreshDatabase;
15+
16+ /**
17+ * @return array
18+ */
19+ public function dataProviderOfGetSortAll (): array
20+ {
21+ return [
22+ 'sort asc ' => [
23+ [
24+ [
25+ 'sort ' => 10 ,
26+ ],
27+ [
28+ 'sort ' => 20 ,
29+ ],
30+ ],
31+ 10 ,
32+ ],
33+ 'sort desc ' => [
34+ [
35+ [
36+ 'sort ' => 30 ,
37+ ],
38+ [
39+ 'sort ' => 20 ,
40+ ],
41+ ],
42+ 20 ,
43+ ],
44+ ];
45+ }
46+
47+ /**
48+ * @test
49+ * @dataProvider dataProviderOfGetSortAll
50+ */
51+ public function it_get_sort_all (
52+ array $ parameterOfDns ,
53+ int $ assertSort
54+ ): void {
55+ foreach ($ parameterOfDns as $ _parameterOfDns ) {
56+ DnsRecordType::factory ($ _parameterOfDns )->create ();
57+ }
58+
59+ $ eloquentDnsRecordTypeQueryService = new EloquentDnsRecordTypeQueryService ();
60+ $ dnsRecords = $ eloquentDnsRecordTypeQueryService ->getSortAll ();
61+
62+ $ firstDnsRecord = $ dnsRecords ->first ();
63+
64+ $ this ->assertSame ($ assertSort , $ firstDnsRecord ->sort );
65+ }
66+ }
You can’t perform that action at this time.
0 commit comments