Skip to content

Instantly share code, notes, and snippets.

View fchris82's full-sized avatar

Krisztián Ferenczi fchris82

View GitHub Profile
@fchris82
fchris82 / banchmark.php
Created April 16, 2019 15:22
Benchmark file for symfony console output formatter. You can change the branches and run this to compare speeds. The lexer version could be slow with large texts! How to use: copy this file into the root of symfony project and run `php benchmark.php`
<?php
/*
1000x original
--------------
Short 0.03s
Short with tags 0.29s
Simple 0.03s
With tags 1.56s
100x new
@fchris82
fchris82 / PhpUnitTrait.php
Created July 24, 2018 12:57
Trait to PHPUnit tests (allow protected things and deepClone)
trait PhpUnitTrait
{
protected function callObjectProtectedMethod($object, $methodName, $args = [])
{
$reflMethod = new \ReflectionMethod(get_class($object), $methodName);
$reflMethod->setAccessible(true);
return $reflMethod->invokeArgs($object, $args);
}
<?php
namespace Diginin\TestingBundle\Behat\Cli;
use Behat\Testwork\Cli\Controller;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;