-
Notifications
You must be signed in to change notification settings - Fork 7
[WIP] common collaborators #3
base: master
Are you sure you want to change the base?
Changes from 5 commits
55f260f
0f6d68f
634f37b
64b7da5
11feb78
05ebcd7
36b9c28
0e97ad4
35740e8
1483774
43de656
e40642c
ae0deda
c18f931
ee29164
01363b0
924fe12
5c96a1f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
Feature: Provide default collaborators | ||
As a Developer | ||
I want to avoid configuring framework mocks every time by hand | ||
In order to have a working preconfigured set of mocks | ||
|
||
Background: | ||
Given the Symfony extension is enabled with: | ||
""" | ||
extensions: | ||
PhpSpec\Symfony2Extension\Extension: | ||
router: Symfony\Component\Routing\RouterInterface | ||
""" | ||
|
||
Scenario: Controller has access to common collaborator | ||
Given I wrote a spec in the "src/CommonCollaborator/Spec/Controller.php": | ||
""" | ||
<?php | ||
|
||
namespace CommonCollaborator\Spec; | ||
|
||
use PhpSpec\ObjectBehavior; | ||
|
||
class Controller extends ObjectBehavior | ||
{ | ||
function it_has_access_to_router($container, $router) // magic! | ||
{ | ||
$this->setContainer($container); | ||
$this->generateUrl('homepage')->shouldHaveType('string'); | ||
} | ||
} | ||
|
||
""" | ||
And I wrote a class in the "src/CommonCollaborator/Controller.php": | ||
""" | ||
<?php | ||
|
||
namespace CommonCollaborator; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Controller\Controller as BaseController; | ||
|
||
class Controller extends BaseController | ||
{ | ||
} | ||
|
||
""" | ||
When I run phpspec | ||
Then I should see "1 example (1 passed)" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
extensions: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for the example. (to be removed) |
||
PhpSpec\Symfony2Extension\Extension: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this using the new options parameters PR from phpspec/phpspec? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I reverted it until (if) the PR is (not) accepted. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it was breaking travis, cause composer was not using the PR'd version. |
||
common-collaborators: | ||
# append: false # should we support append ? (ie: provide defaults) | ||
router: Symfony\Component\Routing\RouterInterface | ||
request: Symfony\Component\HttpFoundation\Request | ||
#formFactory: { form.factory: FormFactoryInterface } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace spec\PhpSpec\Symfony2Extension\Runner; | ||
|
||
use PhpSpec\ObjectBehavior; | ||
use Prophecy\Argument; | ||
use PhpSpec\Wrapper\Unwrapper; | ||
|
||
class CollaboratorFactorySpec extends ObjectBehavior | ||
{ | ||
function let(Unwrapper $unwrapper) | ||
{ | ||
$this->beConstructedWith($unwrapper); | ||
} | ||
|
||
function it_is_initializable() | ||
{ | ||
$this->shouldHaveType('PhpSpec\Symfony2Extension\Runner\CollaboratorFactory'); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace spec\PhpSpec\Symfony2Extension\Runner\Maintainer; | ||
|
||
use PhpSpec\ObjectBehavior; | ||
use Prophecy\Argument; | ||
use PhpSpec\Wrapper\Unwrapper; | ||
use PhpSpec\Symfony2Extension\Runner\CollaboratorFactory; | ||
|
||
class CommonCollaboratorsMaintainerSpec extends ObjectBehavior | ||
{ | ||
public function let(Unwrapper $unwrapper, CollaboratorFactory $factory) | ||
{ | ||
$this->beConstructedWith($unwrapper, $factory, array()); | ||
} | ||
|
||
function it_is_initializable() | ||
{ | ||
$this->shouldHaveType('PhpSpec\Symfony2Extension\Runner\Maintainer\CommonCollaboratorsMaintainer'); | ||
} | ||
} |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐴
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what with that ? 🐫
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👶 maybe he means the @ handling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah :) it's acceptable in that case imho
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
si un médecin le dit, nous buvons 👶
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha :) don't trust me.