News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

NetTuts.com:
A BDD Workflow With Behat and Phpspec
July 04, 2014 @ 14:20:23

NetTuts.com has posted a new tutorial today showing a sample testing BDD workflow using the Behat and PHPSpec testing tools. The BDD (behavior-driven development) approach focuses on using test-driven development and domain-driven design rather than just a unit testing approach.

In this tutorial, we will have a look at two different BDD tools, Behat and phpspec, and see how they can support you in your development process. Learning BDD can be confusing. New methodology, new tools and many questions, such as "what to test?" and "which tools to use?". I hope that this rather simple example will give you ideas to how you can incorporate BDD into your own workflow.

The article isn't a "getting started with BDD" guide, so you'll need to know a bit about the ideas and process before getting into it. He starts with a look at the workflow Taylor Otwell (his inspiration for this) uses and how to install Behat and get to work on a first feature file. He describes the thought process behind the steps and some of the PHP code required to make them work. He then gets to the use of phpspec to mock out a needed "Config" dependency. He works though the rest of the tests and includes the output when all tests are passing.

0 comments voice your opinion now!
bdd workflow phpspec behat taylorotwell tutorial

Link: http://code.tutsplus.com/tutorials/a-bdd-workflow-with-behat-and-phpspec--cms-21601

NetTuts.com:
Getting Started With Phpspec
May 12, 2014 @ 13:55:10

The NetTuts.com site has a new tutorial that want to help get you started with PHPSpec, the PHP-based tool to help with behavior-driven development.

In this short, yet comprehensive, tutorial, we'll have a look at behavior driven development (BDD) with phpspec. Mostly, it will be an introduction to the phpspec tool, but as we go, we'll touch on different BDD concepts. BDD is a hot topic these days and phpspec has gained a lot of attention in the PHP community recently.

They briefly introduce behavior-driven development (BDD) and where the PHPSpec tool fits into the picture. They guide you through installation of the tool (via Composer) and some configuration updates to get things set up. From there, they help you write your first spec, a test to see if a "TaskCollection" can be created. They build on this simple test adding in checks for adding tasks, making the collection countable and working with expectations and promises. The last part of the tutorial mentions how to make custom matchers like "beTrue" and "beFalse" and the output of the full test set.

0 comments voice your opinion now!
phpspec tutorial introduction behaviordriven development bdd

Link: http://code.tutsplus.com/tutorials/getting-started-with-phpspec--cms-20919

Chris Hartjes:
PHPSpec and the New Wave of Testing
October 19, 2012 @ 08:42:18

Chris Hartjes, a big proponent of testing in web applications (mostly in the PHP realm so far) has a new post to his site with some of his thoughts about PHPSpec, the specification-driven testing tool recently released by the same folks who made Behat.

I think that we are witnessing the first wave of new testing tools in the PHP community that allow developers to wrap their applications in automated tests. I am familiar with the BDD-style that is being promoted in PHPSpec, through my work with Behat to create automated user acceptance tests. I think if you want a tl;dr version of PHPSpec I would tell you "write hybrid unit/integration tests using plain language".

He notes that writing code to match a specification has similar concepts to using unit testing for TDD (with something like PHPUnit). He points out a few interesting things like the use of mock objects and the fact that you'll still need to write some code to make tests work - that's unavoidable right now.

0 comments voice your opinion now!
phpspec testing functional unit specification tdd


Ibuildings techPortal:
Beyond TDD with PHPSpec
August 03, 2011 @ 09:41:20

On the Ibuildings techPortal today there's a new post from Marcello Duarte following up on his previous post looking at behavior driven development (here) with a look at PHPSpec, a port of RSpec that is the first PHP BDD framework.

PHPSpec is the first ever PHP BDD framework. It is a port of RSpec to PHP created back in 2007 by Padraic Brady and Travis Swicegood. Development in this framework stopped for a while and was reignited last August (2010).

He goes over how to get it installed via PEAR and how to write some sample tests following along the topic from his previous post (handing videos and reviews). He gets into a bit more detail by describing how MVC is handled with PHPSpec and how the Zend Framework command line tool can be used to create a controller that satisfies the test.

0 comments voice your opinion now!
behaviordriven development phpspec testdriven framework


DZone.com:
PHPSpec BDD for your classes
June 03, 2011 @ 08:57:12

In a new post to the "PHP on Windows" section of DZone.com, Giorgio Sironi looks at another testing tool to add to your arsenal - PHPSpec, a behavior-driven development testing tool similar to Ruby's RSpec.

Behavior-Driven Development can be seen as an evolution of Test-Driven Development, stricly in its outside-in version and with a refined language. In the case of the tool I'm reviewing today, BDD is implemented with code instead of with textual feature files (e.g. written in Gherkin) like in Behat. PHPSpec is similar to (or a port of) RSpec, the original BDD Ruby tool. It fills the need for an approach different from the classical xUnit at the class level.

He points out the place he thinks PHPSpec has in the software testing world as it fits with things like Behat and PHPUnit. He also includes some sample code to show it at work - a sample test that checks against an object for things like "should be an object" or "should not return the same number for multiples of three" for the basic class FizzBuzz.

0 comments voice your opinion now!
phpspec behaviordriven development testing unittest class


Padraic Brady's Blog:
A Domain Specific Language for Behaviour Driven Development (BDD) in PHP
July 21, 2008 @ 11:13:35

Padraic Brady has posted about a part of his PHPSpec library, the domain specific language.

PHPSpec implements a domain specific language (DSL) in PHP for specifying the behaviour of functional units such as methods and objects. The purpose of a DSL was to move away from the xUnit style declaration of tests towards a specification language centred on describing behaviour.

He illustrates with a bowling example - described with a sample class (with a itShouldScore0ForGutterGame test) and how to use it to fit his proposal:

My proposal therefore is to re-implement the current programming language DSL as a specification language - i.e. a new (extremely limited and narrow!) language capable of being parsed by PHPSpec into its PHP equivalent. [...] Using a specification DSL, we can simply ignore the existence of classes in PHP (well, the pretense is nice). Instead the DSL would incorporate a syntax for denoting shared behaviours.
0 comments voice your opinion now!
behaviour driven development phpspec domain specific language


Padraic Brady's Blog:
The PHPSpec Zend Framework App Testing Manifesto ZF Integration
January 21, 2008 @ 10:21:00

Continuing on from his preamble on the integration of the PHPSpec BDD tool into the Zend Framework, Padraic Brady has posted the next in the series - a look at what it would take to make the integration happen.

The ideal was to move away from line-by-line setup and manipulation of Zend instances towards a more simplified model which is standardised for any PHPSpec specs.

He's already created an "experimental branch" to work inside of and some of these updates have been made to the trunk for the release of PHPSpec 0.3.0. The key that he found was in getting the customization of the "Zend Context operational to set up elements of the FrontController". He also includes a simple example of the extended functionality in action - simple interface methods to work with Twitter.

0 comments voice your opinion now!
phpspec bdd zendframework integrate testing example


Padraic Brady's Blog:
ext/snarl PHP interface to the Windows Snarl Notification Tool API
January 16, 2008 @ 09:33:00

In a post a little while back, Padraic Brady wrote about an extension he whipped up to act as an interface between PHP and the Snarl notification tool (inspired by Growl from OS X).

My intention for the API is to facilitate Window's use of a soon to be announced tool for autotesting in PHP using PHPSpec.

He wants to use it in an automated testing environment that, when tests are detected in the current tests, runs the changed items and reports back the results via the Windows notification service. You can grab the code from the Google Code repository for it and test it our for yourself.

0 comments voice your opinion now!
windows snarl extension api pecl testing phpspec windows snarl extension api pecl testing phpspec


Padraic Brady's Blog:
The PHPSpec Zend Framework App Testing Manifesto Preamble
January 14, 2008 @ 10:22:00

Padraic Brady has posted a manifesto of sorts about the work that he's been doing on his PHPSpec library and trying to work it into the approval process for the Zend Framework.

I'll be attempting to pound the Zend Framework into submission so I can apply Behaviour-Driven Development (BDD) using PHPSpec when I write a Controller. Why? Because I feel like it, and it gives me an excuse to promote one possible incarnation of PHPMock and the PHPSpec Zend Framework extension. See? Perfectly reasonable selfishness!

He hopes to move it past the typical test-driven development process that PHPUnit offers and "kick your ass into high-TDD gear" without having to have worked much with it before then (the key is simplicity).

He includes some code examples (how it should flow) and describes some of the challenges that he's coming across so far, specifically with the way that the Zend Framework works with the Controllers and what he wants to accomplish.

0 comments voice your opinion now!
bdd tdd testdriven development phpspec phpmock phpunit zendframework bdd tdd testdriven development phpspec phpmock phpunit zendframework


Padraic Brady's Blog:
PHPSpec 0.2.0 Released
January 10, 2008 @ 14:32:00

Padraic Brady has officially released the latest version of his behavior-driven development framework PHPSpec 0.2.0:

With the beta release behind us, I'm happy to announce the immediate availability of PHPSpec 0.2.0 from the project's pear channel at pear.phpspec.org or you can download directly from http://pear.phpspec.org/get.

Also included in his post are details about the release (like the Changelog), links to download the latest edition and some personal "thank you"s to developers who submitted patches to bring it from beta to a full release.

0 comments voice your opinion now!
phpspec behaviour development library release phpspec behaviour development library release



Community Events





Don't see your event here?
Let us know!


refactor framework release unittest threedevsandamaybe series list opinion developer interview language laravel install community testing code introduction podcast configure wordpress

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework