Skip to content

Instantly share code, notes, and snippets.

Konstantin Kudryashov everzet

View GitHub Profile
@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()
@everzet
everzet / autoload.php
Created Jul 24, 2012
app/autoload.php for Behat 2.4+ & Symfony2.1+
View autoload.php
<?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();
}
View 54_traits_properties.php
<?php
trait one {
public $prop;
protected function someMethod()
{
// do something hidden from the
// outside world
}
@everzet
everzet / watch.rb
Created Apr 11, 2012
https://github.com/mynyml/watchr script to continuously run Behat and PHPUnit test suites on classes/features that have been modified.
View watch.rb
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 Apr 4, 2012
Install Mink with ALL available drivers
View composer.json
{
"require": {
"behat/mink": "*",
"fabpot/goutte": "*",
"alexandresalome/php-selenium": "*",
"facebook/php-webdriver": "*",
"behat/sahi-client": "*"
},
@everzet
everzet / php.rb
Created Mar 2, 2012
php 5.4 formula for homebrew
View php.rb
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 Feb 3, 2012
Homebrew reciept for php 5.3.10
View php.rb
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 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 / ExceptionalClient.php
Created Jan 18, 2012
View real exceptions in Behat output with Mink+SymfonyDriver in your Symfony2 feature suite
View ExceptionalClient.php
<?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 Jan 6, 2012
Fix `Class 'Symfony\Component\Console\Application' not found in vendor/behat/behat/src/Behat/Behat/Console/BehatApplication.php on line 26` bug
View behat_+_mink_composer.json
{
"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",
You can’t perform that action at this time.