|
6 | 6 | use Blueprint\Generators\MigrationGenerator;
|
7 | 7 | use Blueprint\Tree;
|
8 | 8 | use Carbon\Carbon;
|
9 |
| -use Illuminate\Support\Facades\App; |
10 | 9 | use Symfony\Component\Finder\SplFileInfo;
|
11 | 10 | use Tests\TestCase;
|
12 | 11 |
|
@@ -53,7 +52,7 @@ public function output_writes_nothing_for_empty_tree()
|
53 | 52 | */
|
54 | 53 | public function output_writes_migration_for_model_tree($definition, $path, $migration)
|
55 | 54 | {
|
56 |
| - if ($migration === 'migrations/return-type-declarations.php') { |
| 55 | + if ($migration === 'migrations/return-type-declarations.php') { |
57 | 56 | $this->app['config']->set('blueprint.use_return_types', true);
|
58 | 57 | }
|
59 | 58 |
|
@@ -85,7 +84,7 @@ public function output_writes_migration_for_model_tree($definition, $path, $migr
|
85 | 84 | */
|
86 | 85 | public function output_updates_migration_for_model_tree($definition, $path, $migration)
|
87 | 86 | {
|
88 |
| - if ($migration === 'migrations/return-type-declarations.php') { |
| 87 | + if ($migration === 'migrations/return-type-declarations.php') { |
89 | 88 | $this->app['config']->set('blueprint.use_return_types', true);
|
90 | 89 | }
|
91 | 90 |
|
@@ -608,6 +607,34 @@ public function output_generates_constraint_for_uuid()
|
608 | 607 | $this->assertEquals(['created' => [$timestamp_path]], $this->subject->output($tree));
|
609 | 608 | }
|
610 | 609 |
|
| 610 | + /** |
| 611 | + * @test |
| 612 | + */ |
| 613 | + public function output_respects_softdelete_order() |
| 614 | + { |
| 615 | + $this->app->config->set('blueprint.use_constraints', true); |
| 616 | + |
| 617 | + $this->filesystem->expects('stub') |
| 618 | + ->with('migration.stub') |
| 619 | + ->andReturn($this->stub('migration.stub')); |
| 620 | + |
| 621 | + $now = Carbon::now(); |
| 622 | + Carbon::setTestNow($now); |
| 623 | + |
| 624 | + $timestamp_path = 'database/migrations/' . $now->format('Y_m_d_His') . '_create_comments_table.php'; |
| 625 | + |
| 626 | + $this->filesystem->expects('exists') |
| 627 | + ->with($timestamp_path) |
| 628 | + ->andReturn(false); |
| 629 | + |
| 630 | + $this->filesystem->expects('put') |
| 631 | + ->with($timestamp_path, $this->fixture('migrations/soft-deletes-respect-order.php')); |
| 632 | + |
| 633 | + $tokens = $this->blueprint->parse($this->fixture('drafts/soft-deletes-respect-order.yaml')); |
| 634 | + $tree = $this->blueprint->analyze($tokens); |
| 635 | + $this->assertEquals(['created' => [$timestamp_path]], $this->subject->output($tree)); |
| 636 | + } |
| 637 | + |
611 | 638 | public function modelTreeDataProvider()
|
612 | 639 | {
|
613 | 640 | return [
|
|
0 commit comments