Skip to content

Instantly share code, notes, and snippets.

@everzet
everzet / autoload.php
Created July 24, 2012 14:29
app/autoload.php for Behat 2.4+ & Symfony2.1+
<?php
use Doctrine\Common\Annotations\AnnotationRegistry;
if (!class_exists('Composer\\Autoload\\ClassLoader', false)) {
$loader = require __DIR__.'/../vendor/autoload.php';
} else {
$loader = new Composer\Autoload\ClassLoader();
$loader->register();
}
<?php
trait one {
public $prop;
protected function someMethod()
{
// do something hidden from the
// outside world
}
@everzet
everzet / watch.rb
Created April 11, 2012 13:31
https://github.com/mynyml/watchr script to continuously run Behat and PHPUnit test suites on classes/features that have been modified.
watch( '(src/.*\.feature)$' ) {|md| system("./console -e=test behat -fprogress #{md[1]}") }
watch( '(src/.*\.php)$' ) {|md| system("phpunit -c app src") }
@everzet
everzet / composer.json
Created April 4, 2012 08:27
Install Mink with ALL available drivers
{
"require": {
"behat/mink": "*",
"fabpot/goutte": "*",
"alexandresalome/php-selenium": "*",
"facebook/php-webdriver": "*",
"behat/sahi-client": "*"
},
@everzet
everzet / php.rb
Created March 2, 2012 09:06
php 5.4 formula for homebrew
require 'formula'
def mysql_installed?
`which mysql_config`.length > 0
end
def postgres_installed?
`which pg_config`.length > 0
end
@everzet
everzet / php.rb
Created February 3, 2012 05:06
Homebrew reciept for php 5.3.10
require 'formula'
def mysql_installed?
`which mysql_config`.length > 0
end
def postgres_installed?
`which pg_config`.length > 0
end
@everzet
everzet / ExceptionalClient.php
Created January 18, 2012 16:44
View real exceptions in Behat output with Mink+SymfonyDriver in your Symfony2 feature suite
<?php
namespace Your\MainBundle;
use Symfony\Bundle\FrameworkBundle\Client;
use Symfony\Component\HttpKernel\HttpKernelInterface;
class ExceptionalClient extends Client
{
static private $catchExceptions = true;
@everzet
everzet / behat_+_mink_composer.json
Created January 6, 2012 11:28
Fix `Class 'Symfony\Component\Console\Application' not found in vendor/behat/behat/src/Behat/Behat/Console/BehatApplication.php on line 26` bug
{
"require": {
...
"symfony/console": "2.0.7",
"symfony/dependency-injection": "2.0.7",
"symfony/event-dispatcher": "2.0.7",
"symfony/translation": "2.0.7",
"symfony/finder": "2.0.7",
@everzet
everzet / composer.json
Created January 5, 2012 14:55
composer.json VS deps
{
"require": {
"php": ">=5.3.2",
"symfony/symfony": ">=2.0.7,<2.1.0-dev",
"doctrine/orm": "2.1.*",
"twig/extensions": "*",
"symfony/assetic-bundle": "*",
"sensio/generator-bundle": "2.0.*",
"sensio/framework-extra-bundle": "2.0.*",
@everzet
everzet / composer.json
Created December 31, 2011 16:03
Install & use Behat+Mink+CommonContexts with ALL dependencies through Composer
{
"require": {
"behat/behat": ">=2.2.2",
"behat/mink": ">=1.3.2",
"behat/common-contexts": "*"
},
"repositories": {
"behat/mink-deps": { "composer": { "url": "behat.org" } }
},