Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

Commit 1864a97

Browse files
committed
include Feature and Job classes in tests
1 parent 82f3a3c commit 1864a97

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

src/Generators/FeatureGenerator.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,12 @@ private function generateTestFile($feature, $service)
8181
$content = file_get_contents($this->getTestStub());
8282

8383
$namespace = $this->findFeatureTestNamespace($service);
84-
$testClass = $feature.'Test';
84+
$featureNamespace = $this->findFeatureNamespace($service)."\\$feature";
85+
$testClass = $feature.'Test';
8586

8687
$content = str_replace(
87-
['{{namespace}}', '{{testclass}}', '{{feature}}'],
88-
[$namespace, $testClass, mb_strtolower($feature)],
88+
['{{namespace}}', '{{testclass}}', '{{feature}}', '{{feature_namespace}}'],
89+
[$namespace, $testClass, mb_strtolower($feature), $featureNamespace],
8990
$content
9091
);
9192

src/Generators/JobGenerator.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,12 @@ private function generateTestFile($job, $domain)
7171
$content = file_get_contents($this->getTestStub());
7272

7373
$namespace = $this->findDomainJobsTestsNamespace($domain);
74+
$jobNamespace = $this->findDomainJobsNamespace($domain)."\\$job";
7475
$testClass = $job.'Test';
7576

7677
$content = str_replace(
77-
['{{namespace}}', '{{testclass}}', '{{job}}'],
78-
[$namespace, $testClass, mb_strtolower($job)],
78+
['{{namespace}}', '{{testclass}}', '{{job}}', '{{job_namespace}}'],
79+
[$namespace, $testClass, mb_strtolower($job), $jobNamespace],
7980
$content
8081
);
8182

src/Generators/stubs/feature-test.stub

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?php
2-
namespace {{namespace}}
2+
namespace {{namespace}};
33

4-
use TestCase;
4+
use PHPUnit_Framework_TestCase as TestCase;
5+
use {{feature_namespace}};
56

67
class {{testclass}} extends TestCase
78
{

src/Generators/stubs/job-test.stub

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?php
2-
namespace {{namespace}}
2+
namespace {{namespace}};
33

4-
use TestCase;
4+
use {{job_namespace}};
5+
use PHPUnit_Framework_TestCase as TestCase;
56

67
class {{testclass}} extends TestCase
78
{

0 commit comments

Comments
 (0)