How to run one spec file in Symfony?

397 views
Skip to first unread message

Gonzalo Vilaseca

unread,
May 14, 2014, 8:51:28 AM5/14/14
to phpsp...@googlegroups.com
I'm struggling finding the way to run only one spec file in Symfony2.

Phpspec help shows this:

php bin/phpspec run spec/ClassNameSpec.php
Will run only the ClassNameSpec.

But I cannot get this to work. I always get:
0 specs
0 examples

I've tried all the possible path combinations to the spec file with no success such as:

php bin/phpspec run src/Bundle/DBParameterBundle/spec/Bundle/DBParameterBundle/Service/TempParameterStorageManagerSpec.php
php bin/phpspec run spec/Bundle/DBParameterBundle/Service/TempParameterStorageManagerSpec.php

or even
php bin/phpspec run src/Reiss/DBParameterBundle/spec/
..etc

Has anyone managed to accomplish this in Symfony?

Currently I can only run all tests that are defined in a suite.

Thanks.

Kamil Wreczycki

unread,
Jun 24, 2014, 12:00:20 PM6/24/14
to phpsp...@googlegroups.com
Hi there,
I don't know how you've configured suites for your bundles, but let say that configuration looks like that:

foo_products_suite:
 namespace: Foo\ProductsBundle
 spec_path: src/Foo/ProductsBundle
 spec_prefix: Spec

all you need to run a single spec for this suite is:

bin/phpspec run src/Foo/ProductsBundle/Service.php

should be also another way to run:

 bin/phpspec run Foo\ProductsBundle\Service

but for me this solution isn't working.
Reply all
Reply to author
Forward
0 new messages