Skip to content

kandalf/pehpino

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PeHPino
=======

PeHPino is intended to be a Cucumber[1] approach for PHP.

Cucumber is a tool that "lets software development teams describe how
software should behave in plain text". As it is written in Ruby it's
integration with PHP is not as tight as it might be, and it is also
not nice having to learn a different programming language just to
write your tests. There was also the problem that I have not found any
other nice approach for Behaviour Driven Development (BDD) on PHP. The
sum of all this factors[*] gave birth to PeHPino.

PeHPino aims to provide a descriptive BDD approach being testing
framework agnostic, that is you could write your tests using your
favorite framework. Having your specs written this way, it can be used
as documentation, since it's plain english and also will help you if
you're willing to migrate a system from PHP to some other platform
supported by Cucumber.

PeHPino is currently on alpha phase, which means that it is not
complete and bugs will raise at unexpected (or not) places. The syntax
is not written on stone either, so it is likely that is going to
change. Please take this into account if you would like to implement
this on production environments.

The current version comes with a very simple example feature, which
has been copied from an existing application using Cucumber, so its
syntax is valid.

Defining Steps
==============

PHPino will search for all files located under the steps/ directory
and will load the steps defined there. 

Example
=======

Supose you have the feature:
Given I am logged in

Assuming you're using PHPUnit, the way you should define this step is
something like:

<?php

Given("I am logged in") {
    $user = User::findById(1);
    $user->login();
    $this->assertTrue($user->isLoggedIn());
}

?>

Note that the php tags are not required, because this is a
pseudo-valid PHP code. The step name is not exactly valid, but the
body of the step definition must be valid PHP code and here is where
you have to specify your test code.

This is a work in progress, in a very early stage, but it looks
promising, stay tuned if you're interested.

Leonardo Mateo (a.k.a. kandalf)

[1] http://cukes.info
[*] I also must confess that PHP syntax sucks, specially for this kind
of descriptive things.

About

A new flavor for PHP BDD

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages