Download the PHP package sizuhiko/cakephp-bdd without Composer

On this page you can find all versions of the php package sizuhiko/cakephp-bdd. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cakephp-bdd

Bdd

BDD(Behavior Driven Development) integration plugin for CakePHP2

Copyright(c) 2012 Sizuhiko. Licensed under the MIT license.

Overview

This plugin focuses on BDD for CakePHP application development. Like a Ruby on Rails, we can use 2 frameworks that are Story and Spec on CakePHP2. This plugin integrates to followings:

Spec for PHP(https://github.com/drslump/Spec-PHP) was inspired on RSpec from the Ruby world. Behat(http://behat.org/) is PHP version clone of famous BDD framework cucumber in Ruby on Rails.

Why these framework was chosen ? Because I think good that these are able to use natural language syntax to express expectations used by DSL. It is easy and reader-friendly !!

Story framework is used to only the acceptance test. Spec framework focuses on unit or functional test in piece of the test senario.

Then, the shell task of executing it by "cake Bdd.story" or "cake Bdd.spec" like "rake cucumber" or "rake spec" was made. It is BddPlugin for CakePHP2 !!

Usage

Require

Followings dependency installed by Composer.

Install

Under the plugins directory of CakePHP root, execute the following commands.

With A Multi-Framework Composer Library Installer

If you want to use 'A Multi-Framework Composer Library Installer'(https://github.com/composer/installers), then you should add repositories section in composer.json of your application.

Minimum Stability

If you don't set dev to Minimum Stability then you should append dependencies stabilities :

Configuration

Plugin load setting

Add the following code in app/Config/bootstrap.php

Bake initial templates

Next, the following commands are executed. (on root of CakePHP)

Application root URL setting

Setting your application root url into app/Config/behat.yml.

This specifies the host name, the port number, and the application name, etc. by the one to set passing the route of the application. Setting it to the host name that can be identified to the test environment as much as possible is recommended.

Do you end by this?

A basic environmental setting ends by this. Bdd plugin is an executable situation.

Your application database settings.

An initial value of config/database.php is $default. When UnitTest is executed, $test might already been defined. Story framework is executed by the browser access. Data base ($test) for the test cannot access to without the change in the setting.

When test step registers the test data, Bdd plugin uses $test. Therefore, the definition is needed without fail. My recommendation is that the data base setting is switched by the environment like "Easy peasy database config" of Bakery. http://bakery.cakephp.org/articles/joelmoss/2006/11/16/easy-peasy-database-config

In sample application (sample) of the inclusion, it switch based on the accessed server name. When the accessed host name is test.localhost, the data base for test is used. When it is not so, the data base for development is used. It will become possible to use test.localhost if it set "127.0.0.1 localhost and test.localhost" into the hosts file. It is easy.

How to insert test data

Into the step file on story framework

Bdd.story has two methods that can be used with the step file.

Into the spec file on spec framework

Bdd.spec can use fixture of CakePHP. In before block, can use $W->fixtures = array(....) looks like $fixtures = array(...) on your CakeTestCase.

Code Coverage.

We can output code coverage report. The feature can do only specs.

lib/Cake/Console/cake Bdd.spec --coverage-html report

write some html to 'report' directory.

Stories code coverage

If you want output coverage report with stories, may be able to use Console/CodeCoverageManager. Example for using CodeCoverageManager is included in Console/Command/SpecShell.php And, in your webserver's php.ini configuration file, configure the auto_prepend_file and auto_append_file, respectively. Please refer http://www.phpunit.de/manual/current/en/selenium.html

Original i18n files for stories

We can replace mink-extention i18n files. If you add or edit transration files, followings:

Let's execute it.

Move to the directory CakePHP root(including lib, app, and plugins), and next, execute the following commands.

lib/Cake/Console/cake Bdd.spec lib/Cake/Console/cake Bdd.story

You can use any of original framework options. Please check lib/Cake/Console/cake Bdd.story --help lib/Cake/Console/cake Bdd.spec --help

The command operates only by the CakePHP root directory. Please note it.

Sample Appliacation and Test code, Tutorial

https://github.com/sizuhiko/BddExampleApp

It include English and Japanese features and some specs. And the README.md is Bdd plugin tutorial !!


All versions of cakephp-bdd with dependencies

PHP Build Version
Package Version
Requires composer/installers Version *
behat/mink-extension Version 1.2.*@dev
sizuhiko/spec-php Version 0.9.6.*
behat/common-contexts Version 1.2.*@dev
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sizuhiko/cakephp-bdd contains the following files

Loading the files please wait ....