Skip to content

Instantly share code, notes, and snippets.

@everzet
everzet / composer.json
Created December 22, 2011 08:56
Install & use Behat+Mink with ALL dependencies through Composer
{
"require": {
"behat/behat": ">=2.2.2",
"behat/mink": ">=1.3.2"
},
"repositories": {
"behat/mink-deps": { "composer": { "url": "behat.org" } }
}
}
@everzet
everzet / download_and_fix_selenium.sh
Created December 20, 2011 10:58
Get selenium 2.15 with latest Firefox fix
#!/bin/sh
wget http://selenium.googlecode.com/files/selenium-server-standalone-2.15.0.jar
jar xf selenium-server-standalone-2.15.0.jar core/scripts/atoms.js
ed -- "core/scripts/atoms.js" <<-PATCH
9423s|a.|XPCNativeWrapper(a).|
w
q
PATCH
@everzet
everzet / composer.json
Created December 14, 2011 14:09
Composer package to install Behat
{
"require": {
"behat/behat": ">=2.2.0"
}
}
@everzet
everzet / resource_watcher_usage.php
Created November 29, 2011 22:40
Symfony2.1 ResourceWatcher usage example
<?php
$watcher = new Symfony\Component\ResourceWatcher\ResourceWatcher;
// track any change inside directory:
$watcher->track('some/folder1', function($event) {
echo '['.$event->getType().'] '.$event->getResource()."\n"
});
@everzet
everzet / GeekyMinkContext.php
Created October 3, 2011 11:48
Geeky context for Behat + Mink
<?php
use Behat\Mink\Behat\Context\MinkContext;
/**
* Provides basic steps to test your web app from the geek perspective.
*/
class GeekyMinkContext extends MinkContext
{
/**
@everzet
everzet / php.rb
Created August 23, 2011 20:30
brew formula for php 5.3.8
require 'formula'
def mysql_installed?
`which mysql_config`.length > 0
end
class Php < Formula
url 'http://www.php.net/get/php-5.3.8.tar.gz/from/this/mirror'
homepage 'http://php.net/'
md5 'f4ce40d5d156ca66a996dbb8a0e7666a'
@everzet
everzet / AppKernel.php
Created June 27, 2011 12:07
How to configure BehatBundle and MinkBundle to run goutte sessions efficiently
<?php
public function registerBundles()
{
// ...
if ('test' === $this->getEnvironment()) {
$bundles[] = new Behat\MinkBundle\BehatMinkBundle();
$bundles[] = new Behat\BehatBundle\BehatBundle();
}
// ...
@everzet
everzet / bad_steps_proposition.php
Created June 7, 2011 19:12 — forked from alexandresalome/gist:1012539
Explaining why classes are not possible in Behat as step definitions
<?php
/*
You can't use classes like this to define steps by the simple reason:
in Behat and Cucumber, step definitions and test contexts ARE two
splitted logical elements, not one. Different step definitions
can be used together in different scenarios and each scenario will
have it's own context (environment) object. That's the main logical
idea behind Behat - define step once - use it everywhere.
@everzet
everzet / bdd_in_phpunit__vs__phpspec.php
Created May 19, 2011 20:58
comparison of BDD-style PHPUnit VS PHPSpec1 (has almost nothing to do with phpspec2)
<?php
// how that:
class DescribeContextZend extends PHPSpec_Context
{
public function itShouldSetControllerNameUsingContextClass()
{
$context = new DescribeFooController;
$this->spec($context->getController())->should->be('Foo');
@everzet
everzet / config_dev.yml
Created April 27, 2011 12:50
Enabling BehatBundle
framework:
test: ~
behat_mink:
start_url: http://your_app_local.url/app_dev.php/
behat: ~