PHP code example of sizuhiko / cakephp-bdd

1. Go to this page and download the library: Download sizuhiko/cakephp-bdd library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sizuhiko / cakephp-bdd example snippets


CakePlugin::load('Bdd');

$steps->Given('/^there is a post:$/', function($world, $table) {
  $hash = $table->getHash();
  $world->truncateModel('Post');
  $post = $world->getModel('Post');
  foreach ($hash as $row) {
	$post->create(array('Post'=>array('title'=>$row['Title'], 'body'=>$row['Body'])));
	$post->save();
  }
});

describe "Post"
  context "with fixture"
    before
      $W->fixtures = array('app.post');
    end
    ....
sh
cd plugins
git clone [email protected]:sizuhiko/Bdd.git
cd Bdd
curl -s https://getcomposer.org/installer | php
php composer.phar install --dev
cd ..
sh
ls
  app  index.php  lib  plugins  vendors

lib/Cake/Console/cake Bdd.init