Skip to content

Instantly share code, notes, and snippets.

@everzet
everzet / BasicRepresenter.php
Created September 22, 2012 15:15
How BasicRepresenter object specification looks inside PHPSpec2
<?php
namespace spec\PHPSpec2\Formatter\Representer;
use PHPSpec2\ObjectBehavior;
use PHPSpec2\MethodBehavior;
class BasicRepresenter extends ObjectBehavior
{
function it_should_represent_any_value()
@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 / FeatureContext.php
Created January 26, 2012 16:28
Describing your Symfony2 console commands with BehatBundle
<?php
namespace Acme\DemoBundle\Features\Context;
use Behat\BehatBundle\Context\BehatContext,
Behat\Behat\Context\TranslatedContextInterface,
Behat\Behat\Exception\PendingException;
use Behat\Gherkin\Node\PyStringNode,
Behat\Gherkin\Node\TableNode;
@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",