예제 #1
0
 /** @test */
 function it_destroys_a_source_table()
 {
     $modelBuilder = $this->prophesize('Nuclear\\Hierarchy\\Contract\\Builders\\ModelBuilderContract');
     $modelBuilder->destroy('project')->willReturn(null)->shouldBeCalled();
     $formBuilder = $this->prophesize('Nuclear\\Hierarchy\\Contract\\Builders\\FormBuilderContract');
     $formBuilder->destroy('project')->willReturn(null)->shouldBeCalled();
     $migrationBuilder = $this->prophesize('Nuclear\\Hierarchy\\Contract\\Builders\\MigrationBuilderContract');
     $migrationBuilder->getMigrationClassPathByKey('project')->willReturn('TestMigration')->shouldBeCalled();
     $migrationBuilder->destroySourceTableMigration('project', [])->shouldBeCalled();
     $service = new BuilderService($modelBuilder->reveal(), $migrationBuilder->reveal(), $formBuilder->reveal());
     // At this time it is kind of impossible
     // to test if the migration did run like we do
     // in the build tests since it quits before reaching
     // the destroySourceTableMigration method
     // We assume if the destroySourceTableMigration is
     // called, the method reached to the end without any problem
     $service->destroyTable('project', [], 1);
 }