Skip to content

Commit 27bfa1f

Browse files
authored
Merge pull request #3 from jwage/fix-code-spacing
Fix issues with weird code formatting of generated test.
2 parents b561cc5 + 0582c66 commit 27bfa1f

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

lib/Templates/test-class.html.twig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ class {{ shortName }} extends TestCase
2020
private ${{ property.propertyName }};
2121
2222
{% endfor %}
23-
2423
{% for testMethod in testClassMetadata.testMethods %}
2524
public function test{{ testMethod.methodName|slice(0, 1)|upper }}{{ testMethod.methodName|slice(1) }}() : void
2625
{
@@ -36,10 +35,11 @@ class {{ shortName }} extends TestCase
3635
$this->{{ body.parameterName }}->{{ body.methodName }}(
3736
{% for parameter in body.parameters %}
3837
${{ parameter }}{% if not loop.last %},{% endif %}
38+
3939
{% endfor %}
40-
);
40+
);
4141
{% endif %}
42-
{%endfor %}
42+
{% endfor %}
4343
4444
}
4545
@@ -52,6 +52,7 @@ class {{ shortName }} extends TestCase
5252
{% for setUpDependency in testClassMetadata.setUpDependencies if setUpDependency.type == 'normal' %}
5353
$this->{{ setUpDependency.propertyName }} = {{ setUpDependency.propertyValue }};
5454
{% endfor %}
55+
5556
{% for setUpDependency in testClassMetadata.setUpDependencies if setUpDependency.type == 'sut' %}
5657
{% if setUpDependency.parameters|length > 0 %}
5758
$this->{{ setUpDependency.propertyName }} = new {{ setUpDependency.propertyType }}(

tests/TestClass.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ public function getTestStringArgument() : string
5050
return $this->testStringArgument;
5151
}
5252

53+
public function getTestMethodWithArguments(string $a, float $b, int $c) : void
54+
{
55+
}
56+
5357
public function getSomething() : string
5458
{
5559
return 'something';

tests/TestClassGeneratorTest.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class TestClassTest extends TestCase
3939
/** @var TestClass */
4040
private $testClass;
4141
42-
4342
public function testGetTestDependency() : void
4443
{
4544
$this->testClass->getTestDependency();
@@ -60,6 +59,19 @@ public function testGetTestStringArgument() : void
6059
$this->testClass->getTestStringArgument();
6160
}
6261
62+
public function testGetTestMethodWithArguments() : void
63+
{
64+
$a = '';
65+
$b = '';
66+
$c = '';
67+
$this->testClass->getTestMethodWithArguments(
68+
$a,
69+
$b,
70+
$c
71+
);
72+
73+
}
74+
6375
public function testGetSomething() : void
6476
{
6577
$this->testClass->getSomething();
@@ -71,6 +83,7 @@ protected function setUp() : void
7183
$this->testFloatArgument = 1.0;
7284
$this->testIntegerArgument = 1;
7385
$this->testStringArgument = '';
86+
7487
$this->testClass = new TestClass(
7588
$this->testDependency,
7689
$this->testFloatArgument,

0 commit comments

Comments
 (0)