Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Anyone knows something like RSPec for PHP? [closed]

RSPec is a great ruby test framework (for test driven development), anyone knows something like rspec but, for PHP?

like image 951
Lucas Renan Avatar asked Jun 25 '10 18:06

Lucas Renan


People also ask

How to profile your tests in RSpec?

RSpec comes with a very handy option to profile your tests. Just by passing the --profile flag you’ll be able to see how long each test takes to run & fix the really slow ones. You have learned how to write tests using the RSpec testing framework. Now it’s your turn to start writing your own test!

What is the correct format for RSpec?

RSpec Formatters. The default RSpec output is in the “progress” format. With this format you see dots (.) representing 1 passing test each, an F for a failed test (expected & actual don’t match), or an E for an error. But there are alternative formatting options you can use. Here’s a list: progress; documentation; json; html

What is the difference between let and subject in RSpec?

The let! method is non-lazy, so the object will be created before any tests are run. Another version of let is subject. The only difference is that you can only have one subject, and it’s meant to be an instance of the main object you are testing. RSpec already creates a default subject like this: This is called the “implicit subject”.

How does the change matcher work in RSpec?

The change matcher also works like this: The default RSpec output is in the “progress” format. With this format you see dots (.) representing 1 passing test each, an F for a failed test (expected & actual don’t match), or an E for an error.


2 Answers

Behat! Built on top of Symfony 2 components. Syntactically, not as nice as Ruby implementation but still get the benefits of BDD.

I just stumbled upon it myself and haven't used it yet. From a glance, it looks like it's using closures (which it would need to do to work like RSpec/Cucumber) which is a PHP 5.3 addition.

http://behat.org/

like image 34
Rob Avatar answered Sep 19 '22 14:09

Rob


PHPSpec is a Behaviour-Driven Development framework for php. I've not used it myself yet, though, so I can't comment on it specifically.

like image 180
Daniel Vandersluis Avatar answered Sep 19 '22 14:09

Daniel Vandersluis