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

1

9

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!');
    }
}
Parvis answered 10/7, 2015 at 20:42 Comment(0)
B
18

Specify a line number the example method is defined on:

 phpspec run spec/Project/WorkerSpec.php:9
Burl answered 12/7, 2015 at 9:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.