Skip to content
This repository was archived by the owner on Feb 14, 2021. It is now read-only.

Commit f5a44d4

Browse files
committed
Rolled back the initial implementation to start over.
1 parent bf909ed commit f5a44d4

16 files changed

+115
-729
lines changed

features/describing_a_class.feature

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
Feature: Describing a class
2+
As a Developer
3+
I want to automate creating class specifications
4+
In order to avoid repetitive tasks
5+
6+
Background:
7+
Given the Symfony extension is enabled
8+
9+
@wip
10+
Scenario: Spec is generated in the bundle
11+
When I describe the "Scenario1/Bundle/DemoBundle/Model/User"
12+
Then a new specification should be generated in the "Scenario1/Bundle/DemoBundle/Spec/Model/UserSpec.php":
13+
"""
14+
<?php
15+
16+
namespace Scenario1\Bundle\DemoBundle\Spec\Model;
17+
18+
use PhpSpec\ObjectBehavior;
19+
use Prophecy\Argument;
20+
21+
class UserSpec extends ObjectBehavior
22+
{
23+
function it_is_initializable()
24+
{
25+
$this->shouldHaveType('Scenario1\Bundle\DemoBundle\Model\User');
26+
}
27+
}
28+
29+
"""
30+
31+
@wip
32+
Scenario: Running a spec
33+
Given I described the "Scenario2/Bundle/DemoBundle/Model/User"
34+
When I run phpspec
35+
Then I should see "class Scenario2\Bundle\DemoBundle\Model\User does not exist"
36+
37+
@wip
38+
Scenario: Generating a class
39+
Given I described the "Scenario3/Bundle/DemoBundle/Model/User"
40+
When I run phpspec and answer "y" to the first question
41+
Then a new class should be generated in the "src/Scenario3/Bundle/DemoBundle/Model/User.php":
42+
"""
43+
<?php
44+
45+
namespace Scenario3\Bundle\DemoBundle\Model;
46+
47+
class User
48+
{
49+
}
50+
51+
"""
52+
53+
@wip
54+
Scenario: Executing a class spec
55+
Given I wrote a spec in the "Scenario4/Bundle/DemoBundle/Spec/Model/User.php":
56+
"""
57+
<?php
58+
59+
namespace Scenario4\Bundle\DemoBundle\Spec\Model;
60+
61+
use PhpSpec\ObjectBehavior;
62+
use Prophecy\Argument;
63+
64+
class UserSpec extends ObjectBehavior
65+
{
66+
function it_has_a_string_representation()
67+
{
68+
$this->beConstructedWith('Kuba');
69+
70+
$this->__toString()->shouldReturn('Kuba');
71+
}
72+
}
73+
74+
"""
75+
And I wrote a class in the "src/Scenario4/Bundle/DemoBundle/Model/User.php":
76+
"""
77+
<?php
78+
79+
namespace Scenario4\Bundle\DemoBundle\Model;
80+
81+
class User
82+
{
83+
private $name;
84+
85+
public function __construct($name)
86+
{
87+
$this->name = $name;
88+
}
89+
90+
public function __toString()
91+
{
92+
return $this->name;
93+
}
94+
}
95+
96+
"""
97+
When I run phpspec
98+
Then I should see "1 example (1 passed)"

features/describing_a_controller.feature

Lines changed: 17 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# split into multiple files and add missing scenarios (like run with parameters)
12
Feature: Describing a controller
23
As a Developer
34
I want to automate creating controller specifications
@@ -6,13 +7,14 @@ Feature: Describing a controller
67
Background:
78
Given the Symfony extension is enabled
89

10+
@wip
911
Scenario Outline: Controller spec is generated
1012
When I describe the "<class>"
11-
Then a new specification should be generated in the "spec/Scenario1/Bundle/DemoBundle/Controller/UserControllerSpec.php":
13+
Then a new specification should be generated in the "Scenario1/Bundle/DemoBundle/Spec/Controller/UserControllerSpec.php":
1214
"""
1315
<?php
1416
15-
namespace spec\Scenario1\Bundle\DemoBundle\Controller;
17+
namespace Scenario1\Bundle\DemoBundle\Spec\Controller;
1618
1719
use PhpSpec\Symfony2Extension\Specification\ControllerBehavior;
1820
use Prophecy\Argument;
@@ -21,7 +23,7 @@ Feature: Describing a controller
2123
{
2224
function it_is_initializable()
2325
{
24-
$this->shouldHaveType('Scenario1\Bundle\DemoBundle\Controller\UserController');
26+
$this->shouldHaveType('Scenario1\Bundle\DemoBundle\Spec\Controller\UserController');
2527
}
2628
}
2729
@@ -30,34 +32,9 @@ Feature: Describing a controller
3032
Examples:
3133
| class |
3234
| Scenario1/Bundle/DemoBundle/Controller/UserController |
33-
| spec/Scenario1/Bundle/DemoBundle/Controller/UserController |
34-
35-
Scenario: Non-controller spec is generated with a default template
36-
When I describe the "Scenario2/Bundle/DemoBundle/User"
37-
Then a new specification should be generated in the "spec/Scenario2/Bundle/DemoBundle/UserSpec.php":
38-
"""
39-
<?php
40-
41-
namespace spec\Scenario2\Bundle\DemoBundle;
42-
43-
use PhpSpec\ObjectBehavior;
44-
use Prophecy\Argument;
45-
46-
class UserSpec extends ObjectBehavior
47-
{
48-
function it_is_initializable()
49-
{
50-
$this->shouldHaveType('Scenario2\Bundle\DemoBundle\User');
51-
}
52-
}
53-
54-
"""
55-
56-
Scenario: Running a controller spec
57-
Given I described the "Scenario3/Bundle/DemoBundle/Controller/UserController"
58-
When I run phpspec
59-
Then I should see "class Scenario3\Bundle\DemoBundle\Controller\UserController does not exist"
35+
| Scenario1/Bundle/DemoBundle/Spec/Controller/UserController |
6036

37+
@wip
6138
Scenario: Generating a controller
6239
Given I described the "Scenario4/Bundle/DemoBundle/Controller/UserController"
6340
When I run phpspec and answer "y" to the first question
@@ -75,12 +52,13 @@ Feature: Describing a controller
7552
7653
"""
7754

78-
Scenario: Executing a controller spec with response inspection
79-
Given I wrote a spec in the "spec/Scenario5/Bundle/DemoBundle/Controller/UserControllerSpec.php":
55+
@wip
56+
Scenario: Executing a controller spec with a response inspection
57+
Given I wrote a spec in the "Scenario5/Bundle/DemoBundle/Spec/Controller/UserControllerSpec.php":
8058
"""
8159
<?php
8260
83-
namespace spec\Scenario5\Bundle\DemoBundle\Controller;
61+
namespace Scenario5\Bundle\DemoBundle\Spec\Controller;
8462
8563
use PhpSpec\Symfony2Extension\Specification\ControllerBehavior;
8664
use Prophecy\Argument;
@@ -117,12 +95,13 @@ Feature: Describing a controller
11795
When I run phpspec
11896
Then I should see "1 example (1 passed)"
11997

98+
@wip
12099
Scenario: Executing a controller spec with a service
121-
Given I wrote a spec in the "spec/Scenario6/Bundle/DemoBundle/Controller/UserControllerSpec.php":
100+
Given I wrote a spec in the "Scenario6/Bundle/DemoBundle/Spec/Controller/UserControllerSpec.php":
122101
"""
123102
<?php
124103
125-
namespace spec\Scenario6\Bundle\DemoBundle\Controller;
104+
namespace Scenario6\Bundle\DemoBundle\Spec\Controller;
126105
127106
use PhpSpec\Symfony2Extension\Specification\ControllerBehavior;
128107
use Prophecy\Argument;
@@ -167,12 +146,12 @@ Feature: Describing a controller
167146
Then I should see "1 example (1 passed)"
168147

169148
@wip
170-
Scenario: Executing a controller spec with render matcher
171-
Given I wrote a spec in the "spec/Scenario7/Bundle/DemoBundle/Controller/UserControllerSpec.php":
149+
Scenario: Executing a controller spec with a render matcher
150+
Given I wrote a spec in the "Scenario7/Bundle/DemoBundle/Spec/Controller/UserControllerSpec.php":
172151
"""
173152
<?php
174153
175-
namespace spec\Scenario7\Bundle\DemoBundle\Controller;
154+
namespace Scenario7\Bundle\DemoBundle\Spec\Controller;
176155
177156
use PhpSpec\Symfony2Extension\Specification\ControllerBehavior;
178157
use Prophecy\Argument;

spec/PhpSpec/Symfony2Extension/CodeGenerator/ControllerClassGeneratorSpec.php

Lines changed: 0 additions & 68 deletions
This file was deleted.

spec/PhpSpec/Symfony2Extension/CodeGenerator/ControllerSpecificationGeneratorSpec.php

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)