|
3 | 3 | namespace Tests\Unit; |
4 | 4 |
|
5 | 5 | use Helldar\MigrateDB\Exceptions\InvalidArgumentException; |
| 6 | +use Helldar\Support\Facades\Helpers\Arr; |
6 | 7 | use Illuminate\Support\Facades\DB; |
7 | 8 | use InvalidArgumentException as BaseInvalidArgumentException; |
8 | 9 | use Tests\TestCase; |
@@ -45,34 +46,34 @@ public function testCount() |
45 | 46 |
|
46 | 47 | public function testData() |
47 | 48 | { |
48 | | - $this->assertDatabaseHas($this->table_foo, ['value' => 'foo_q1'], $this->source); |
49 | | - $this->assertDatabaseHas($this->table_foo, ['value' => 'foo_q2'], $this->source); |
50 | | - $this->assertDatabaseHas($this->table_foo, ['value' => 'foo_q3'], $this->source); |
| 49 | + $this->assertDatabaseHas($this->table_foo, ['value' => 'foo_1'], $this->source); |
| 50 | + $this->assertDatabaseHas($this->table_foo, ['value' => 'foo_2'], $this->source); |
| 51 | + $this->assertDatabaseHas($this->table_foo, ['value' => 'foo_3'], $this->source); |
51 | 52 |
|
52 | | - $this->assertDatabaseHas($this->table_bar, ['value' => 'bar_q1'], $this->source); |
53 | | - $this->assertDatabaseHas($this->table_bar, ['value' => 'bar_q2'], $this->source); |
54 | | - $this->assertDatabaseHas($this->table_bar, ['value' => 'bar_q3'], $this->source); |
| 53 | + $this->assertDatabaseHas($this->table_bar, ['value' => 'bar_1'], $this->source); |
| 54 | + $this->assertDatabaseHas($this->table_bar, ['value' => 'bar_2'], $this->source); |
| 55 | + $this->assertDatabaseHas($this->table_bar, ['value' => 'bar_3'], $this->source); |
55 | 56 |
|
56 | | - $this->assertDatabaseHas($this->table_baz, ['value' => 'baz_q1'], $this->source); |
57 | | - $this->assertDatabaseHas($this->table_baz, ['value' => 'baz_q2'], $this->source); |
58 | | - $this->assertDatabaseHas($this->table_baz, ['value' => 'baz_q3'], $this->source); |
| 57 | + $this->assertDatabaseHas($this->table_baz, ['value' => 'baz_1'], $this->source); |
| 58 | + $this->assertDatabaseHas($this->table_baz, ['value' => 'baz_2'], $this->source); |
| 59 | + $this->assertDatabaseHas($this->table_baz, ['value' => 'baz_3'], $this->source); |
59 | 60 |
|
60 | 61 | $this->artisan('db:migrate', [ |
61 | 62 | '--schema-from' => $this->source, |
62 | 63 | '--schema-to' => $this->target, |
63 | 64 | ])->assertExitCode(0)->run(); |
64 | 65 |
|
65 | | - $this->assertDatabaseHas($this->table_foo, ['value' => 'foo_q1'], $this->target); |
66 | | - $this->assertDatabaseHas($this->table_foo, ['value' => 'foo_q2'], $this->target); |
67 | | - $this->assertDatabaseHas($this->table_foo, ['value' => 'foo_q3'], $this->target); |
| 66 | + $this->assertDatabaseHas($this->table_foo, ['value' => 'foo_1'], $this->target); |
| 67 | + $this->assertDatabaseHas($this->table_foo, ['value' => 'foo_2'], $this->target); |
| 68 | + $this->assertDatabaseHas($this->table_foo, ['value' => 'foo_3'], $this->target); |
68 | 69 |
|
69 | | - $this->assertDatabaseHas($this->table_bar, ['value' => 'bar_q1'], $this->target); |
70 | | - $this->assertDatabaseHas($this->table_bar, ['value' => 'bar_q2'], $this->target); |
71 | | - $this->assertDatabaseHas($this->table_bar, ['value' => 'bar_q3'], $this->target); |
| 70 | + $this->assertDatabaseHas($this->table_bar, ['value' => 'bar_1'], $this->target); |
| 71 | + $this->assertDatabaseHas($this->table_bar, ['value' => 'bar_2'], $this->target); |
| 72 | + $this->assertDatabaseHas($this->table_bar, ['value' => 'bar_3'], $this->target); |
72 | 73 |
|
73 | | - $this->assertDatabaseHas($this->table_baz, ['value' => 'baz_q1'], $this->target); |
74 | | - $this->assertDatabaseHas($this->table_baz, ['value' => 'baz_q2'], $this->target); |
75 | | - $this->assertDatabaseHas($this->table_baz, ['value' => 'baz_q3'], $this->target); |
| 74 | + $this->assertDatabaseHas($this->table_baz, ['value' => 'baz_1'], $this->target); |
| 75 | + $this->assertDatabaseHas($this->table_baz, ['value' => 'baz_2'], $this->target); |
| 76 | + $this->assertDatabaseHas($this->table_baz, ['value' => 'baz_3'], $this->target); |
76 | 77 | } |
77 | 78 |
|
78 | 79 | public function testSame() |
@@ -140,6 +141,8 @@ public function testFailedToConnectionName() |
140 | 141 |
|
141 | 142 | protected function tableData(string $connection, string $table): array |
142 | 143 | { |
143 | | - return DB::connection($connection)->table($table)->get()->toArray(); |
| 144 | + $items = DB::connection($connection)->table($table)->get(); |
| 145 | + |
| 146 | + return Arr::toArray($items); |
144 | 147 | } |
145 | 148 | } |
0 commit comments