Skip to content

Instantly share code, notes, and snippets.

Konstantin Kudryashov everzet

Block or report user

Report or block everzet

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@everzet
everzet / FeatureContext.php
Created Jan 26, 2012
Describing your Symfony2 console commands with BehatBundle
View FeatureContext.php
<?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 / FeatureContext.php
Created Aug 13, 2011
How to use MinkContext inside BehatBundle as subcontext
View FeatureContext.php
<?php
namespace Acme\DemoBundle\Features\Context;
use Behat\BehatBundle\Context\BehatContext,
Behat\Behat\Exception\PendingException;
use Behat\Gherkin\Node\PyStringNode,
Behat\Gherkin\Node\TableNode;
/**
@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 / 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)
@everzet
everzet / rspec_in.php
Created May 19, 2011
Why RSpec is not possible in PHP
View rspec_in.php
<?php
/*
Why i think, that "RSpec is not possible in PHP"?
Cuz Ruby's syntax abilities can represent
natural language constructions:
object should equals 2
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 / 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
{
@everzet
everzet / BasicRepresenter.php
Created Sep 22, 2012
How BasicRepresenter object specification looks inside PHPSpec2
View BasicRepresenter.php
<?php
namespace spec\PHPSpec2\Formatter\Representer;
use PHPSpec2\ObjectBehavior;
use PHPSpec2\MethodBehavior;
class BasicRepresenter extends ObjectBehavior
{
function it_should_represent_any_value()
You can’t perform that action at this time.