Skip to content

Instantly share code, notes, and snippets.

Konstantin Kudryashov everzet

View GitHub Profile
View keybase.md

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:

View ESContext.php
<?php
class ESContext
{
/**
* @Given a conference named :name with :count track(s) was scheduled
*/
public function aConferenceNamedWithTrack($name, $count)
{
$this->dispatchEvent(ConferenceNamedWithTracksWasScheduled($name, $count));
View RegistrationContext.php
<?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 Aug 29, 2015
Usage of Behat\Gherkin 2.3
View gherkin_usage.php
<?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 Mar 31, 2014
Registering custom context initializers with behat 3
View behat.yml
default:
extensions:
custom_extension.php: ~
@everzet
everzet / RethrowExceptionListener.php
Last active Feb 27, 2017
Rethrow non-HTTP exceptions in the test environment (aka functional tester saver)
View RethrowExceptionListener.php
<?php
namespace App\EventListener;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
class ExceptionRethrowListener
{
public function onKernelException(GetResponseForExceptionEvent $event)
View gist:5722238
<?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 Dec 18, 2015
Non-verbose SauceLabs connect setup for Travis
View sauce_connect_setup.sh
#!/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 Dec 5, 2012
Why, php? WHY???
View console
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 Nov 1, 2012
Per-specification custom matchers support in phpspec2 alpha3
View phpspec_a3.php
<?php
namespace spec\Bank\Controller;
use PHPSpec2\ObjectBehavior;
use PHPSpec2\Matcher\CustomMatchersProviderInterface;
use PHPSpec2\Matcher\InlineMatcher;
class PaymentController extends ObjectBehavior implements CustomMatchersProviderInterface
{
You can’t perform that action at this time.