Skip to content
This repository was archived by the owner on Nov 27, 2020. It is now read-only.

[3.0] move tests out of src folder #859

Closed
wants to merge 4 commits into from
Closed

[3.0] move tests out of src folder #859

wants to merge 4 commits into from

Conversation

Pierstoval
Copy link
Contributor

Fixes #855

<directory>src/*/*Bundle/Tests</directory>
<directory>src/*/Bundle/*Bundle/Tests</directory>
<directory>src/*Bundle/Tests</directory>
<directory>tests/*</directory>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests is enough actually

@stof
Copy link
Member

stof commented Sep 24, 2015

no need for a .gitkeep in tests IMO

@Pierstoval
Copy link
Contributor Author

Fixed in b83f70e, thanks @stof

@Pierstoval
Copy link
Contributor Author

We may also have to change the sensiolabs/SensioGeneratorBundle generate:bundle command in order to add the tests directly in this new directory, or the default generated tests would not be automatically added to the test suite

@gnugat
Copy link

gnugat commented Sep 24, 2015

Looks good to me, the choice of Tests root namespace allow less constraints than AppBundle\Test.
👍

@@ -1,6 +1,6 @@
<?php

namespace AppBundle\Tests\Controller;
namespace Tests\Controller;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have put that into AppBundle instead: Tests\AppBundle\Controller

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in b71ca58, thanks @fabpot

@Tobion
Copy link
Contributor

Tobion commented Sep 24, 2015

The autoload-dev does not match the test namespace.

@Pierstoval
Copy link
Contributor Author

@Tobion Fixed it in 2856777, if it's what you meant :)

@@ -6,6 +6,9 @@
"autoload": {
"psr-4": { "": "src/" }
},
"autoload-dev": {
"psr-4": { "Tests\\": "tests/" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use AppBundle\\Tests\\ here so that we can keep using the AppBundle\Tests namespace prefix in the test classes?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, if you define multiple bundles, this would make it harder to follow the structure (you would have to change the structure of the testsuite)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know... Forcing the namespace to Tests instead of an empty one sounds better to me because there should not be any other thing than tests.

If we wanted to use AppBundle\Tests it would need the PSR-4 to be { "" : "test/" } and we could put almost anything in it.

Plus, the bundle structure is merely optional, even if @fabpot advised adding it.
At first I prepared the structure as tests/Controller/DefaultControllerTest.php because here we have the whole application tests, and the bundle structure seemed less important to me than the tests we may add in it.

@Tobion
Copy link
Contributor

Tobion commented Sep 29, 2015

👍 good to merge IMO

The remaining thing already has an issue on sensiolabs/SensioGeneratorBundle#416

@weaverryan
Copy link
Member

I share @stof's concern: I recommend the single bundle approach, but I also think adding multiple bundles shouldn't require reworking your structure.

@fabpot
Copy link
Member

fabpot commented Sep 29, 2015

@weaverryan What would you have to change in a multiple-bundle approach?

@weaverryan
Copy link
Member

@fabpot nevermind - I don't know what I was looking at. Tests\AppBundle clearly is laid out perfectly for multi-bundles: 👍

@fabpot
Copy link
Member

fabpot commented Oct 1, 2015

Thank you @Pierstoval.

fabpot added a commit that referenced this pull request Oct 1, 2015
This PR was squashed before being merged into the 3.0-dev branch (closes #859).

Discussion
----------

[3.0] move tests out of src folder

Fixes #855

Commits
-------

d0311d2 [3.0] move tests out of src folder
@fabpot fabpot closed this Oct 1, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants