File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,11 @@ protected function getPath(): string
57
57
58
58
protected function getStubFilepath (): string
59
59
{
60
+ // check for custom stub file
61
+ if (File::exists (base_path ('stubs/one-time-operation.stub ' ))) {
62
+ return File::get (base_path ('stubs/one-time-operation.stub ' ));
63
+ }
64
+
60
65
if ($ this ->essential ) {
61
66
return File::get (__DIR__ .'/../stubs/one-time-operation-essential.stub ' );
62
67
}
Original file line number Diff line number Diff line change @@ -25,4 +25,22 @@ public function it_creates_an_operation_file_instance()
25
25
26
26
File::delete ($ filepath );
27
27
}
28
+
29
+ /** @test */
30
+ public function it_creates_an_operation_file_with_custom_stub ()
31
+ {
32
+ $ mockFile = File::partialMock ();
33
+ $ mockFile ->allows ('exists ' )->with (base_path ('stubs/one-time-operation.stub ' ))->andReturnTrue ();
34
+ $ mockFile ->allows ('get ' )->with (base_path ('stubs/one-time-operation.stub ' ))->andReturns ('This is a custom stub ' );
35
+
36
+ $ directory = Config::get ('one-time-operations.directory ' );
37
+ $ filepath = base_path ($ directory ).DIRECTORY_SEPARATOR .'2015_10_21_072800_test_operation.php ' ;
38
+
39
+ OneTimeOperationCreator::createOperationFile ('TestOperation ' );
40
+
41
+ $ this ->assertFileExists ($ filepath );
42
+ $ this ->assertStringContainsString ('This is a custom stub ' , File::get ($ filepath ));
43
+
44
+ File::delete ($ filepath );
45
+ }
28
46
}
You can’t perform that action at this time.
0 commit comments