Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am everzet on github.
  • I am everzet (https://keybase.io/everzet) on keybase.
  • I have a public key whose fingerprint is E906 3994 7D23 C4AA C736 6CD5 773E 4529 CE27 777F

To claim this, I am signing this object:

<?php
class ESContext
{
/**
* @Given a conference named :name with :count track(s) was scheduled
*/
public function aConferenceNamedWithTrack($name, $count)
{
$this->dispatchEvent(ConferenceNamedWithTracksWasScheduled($name, $count));
<?php
use Behat\Behat\Context\Context;
namespace Context;
class RegistrationContext implements Context
{
/**
* @When I go to the registration page
@everzet
everzet / gherkin_usage.php
Last active August 29, 2015 13:58
Usage of Behat\Gherkin 2.3
<?php
$keywords = new Behat\Gherkin\Keywords\CachedArrayKeywords('/path/to/gherkin_lib/i18n.php');
$lexer = new Behat\Gherkin\Lexer($keywords);
$parser = new Behat\Gherkin\Parser($lexer);
$gherkin = new Behat\Gherkin();
$gherkin->addLoader(new Behat\Gherkin\Loader\DirectoryLoader($gherkin));
$gherkin->addLoader(new Behat\Gherkin\Loader\GherkinFileLoader($parser));
$gherkin->setBasePath(__DIR__ . '/features');
@everzet
everzet / behat.yml
Created March 31, 2014 09:22
Registering custom context initializers with behat 3
default:
extensions:
custom_extension.php: ~
@everzet
everzet / RethrowExceptionListener.php
Last active February 27, 2017 12:18
Rethrow non-HTTP exceptions in the test environment (aka functional tester saver)
<?php
namespace App\EventListener;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
class ExceptionRethrowListener
{
public function onKernelException(GetResponseForExceptionEvent $event)
@everzet
everzet / gist:5722238
Last active December 18, 2015 03:59 — forked from gquemener/gist:5722064
<?php
//PHPUnit
public function testApply() {
$mock = $this->getMock('My\Foo\Class', array('apply'));
$mock->expects($this->any())
->method('apply')
->with('foo')
->will($this->returnValue('bar'));
@everzet
everzet / sauce_connect_setup.sh
Last active December 18, 2015 00:39
Non-verbose SauceLabs connect setup for Travis
#!/bin/bash
# Setup and start Sauce Connect for your TravisCI build
# This script requires your .travis.yml to include the following two private env variables:
# SAUCE_USERNAME
# SAUCE_ACCESS_KEY
# Follow the steps at https://saucelabs.com/opensource/travis to set that up.
#
# Curl and run this script as part of your .travis.yml before_script section:
# before_script:
@everzet
everzet / console
Created December 5, 2012 13:33
Why, php? WHY???
PHP Fatal error: Uncaught exception 'LogicException' with message 'The parent constructor was not called: the object is in an invalid state ' in splfileobject.php:16
Stack trace:
splfileobject.php(16): SplFileInfo->_bad_state_ex()
#1 {main}
thrown in splfileobject.php on line 16
Fatal error: Uncaught exception 'LogicException' with message 'The parent constructor was not called: the object is in an invalid state ' in splfileobject.php:16
Stack trace:
#0 splfileobject.php(16): SplFileInfo->_bad_state_ex()
#1 {main}
@everzet
everzet / phpspec_a3.php
Created November 1, 2012 14:19
Per-specification custom matchers support in phpspec2 alpha3
<?php
namespace spec\Bank\Controller;
use PHPSpec2\ObjectBehavior;
use PHPSpec2\Matcher\CustomMatchersProviderInterface;
use PHPSpec2\Matcher\InlineMatcher;
class PaymentController extends ObjectBehavior implements CustomMatchersProviderInterface
{