Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhpSpec: How can I run only one test from a suite?

Tags:

php

phpspec

I have a phpspec class like below and I only want to run a single spec from it. I would like to run the "it_should_do_something_easy" only. Is this possible?

This is how I run this spec file:

$> phpspec run spec/Project/WorkerSpec.php

But now I only want to run a single spec like "it_should_do_something_easy".

<?php
namespace spec\Project;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class WorkerSpec
{
    public function it_should_do_something_easy()
    {
        $this->doSomethingEasy()->shouldReturn('Done!');
    }

    public function it_should_do_something_hard()
    { 
        $this->doSomethingHard()->shouldReturn('Too hard!');
    }
}
like image 386
Dranzd Avatar asked Jul 10 '15 20:07

Dranzd


1 Answers

Specify a line number the example method is defined on:

 phpspec run spec/Project/WorkerSpec.php:9
like image 75
Jakub Zalas Avatar answered Oct 07 '22 18:10

Jakub Zalas