diff --git a/tests/Console/Generators/CommandMakeJobTest.php b/tests/Console/Generators/CommandMakeJobTest.php new file mode 100644 index 00000000..6c68572e --- /dev/null +++ b/tests/Console/Generators/CommandMakeJobTest.php @@ -0,0 +1,51 @@ +finder = $this->app['files']; + + $this->artisan('make:module', ['slug' => 'jobs', '--quick' => 'quick']); + } + + /** @test */ + public function it_can_generate_a_new_job_with_default_module_namespace() + { + $this->artisan('make:module:job', ['slug' => 'jobs', 'name' => 'DefaultJob']); + + $file = $this->finder->get(module_path('jobs').'/Jobs/DefaultJob.php'); + + $this->assertMatchesSnapshot($file); + } + + /** @test */ + public function it_can_generate_a_new_job_with_custom_module_namespace() + { + $this->app['config']->set("modules.locations.$this->default.namespace", 'App\\CustomJobsNamespace\\'); + + $this->artisan('make:module:job', ['slug' => 'jobs', 'name' => 'CustomJob']); + + $file = $this->finder->get(module_path('jobs').'/Jobs/CustomJob.php'); + + $this->assertMatchesSnapshot($file); + } + + public function tearDown(): void + { + $this->finder->deleteDirectory(module_path('jobs')); + + parent::tearDown(); + } +} \ No newline at end of file diff --git a/tests/Console/Generators/__snapshots__/CommandMakeJobTest__it_can_generate_a_new_job_with_custom_module_namespace__1.php b/tests/Console/Generators/__snapshots__/CommandMakeJobTest__it_can_generate_a_new_job_with_custom_module_namespace__1.php new file mode 100644 index 00000000..0fcab36a --- /dev/null +++ b/tests/Console/Generators/__snapshots__/CommandMakeJobTest__it_can_generate_a_new_job_with_custom_module_namespace__1.php @@ -0,0 +1,35 @@ +