Skip to content

Instantly share code, notes, and snippets.

View CallOrderTest.php
<?php
namespace Test;
use PHPUnit\Framework\TestCase;
interface SystemUnderTest {
public function first(int $arg): int;
public function second(string $arg): string;
}
final class CallOrderTest extends TestCase
{
private $sut;
@lstrojny
lstrojny / FunctionTest.php
Created Mar 22, 2020
SF functional test example
View FunctionTest.php
public function testSomething(): void
{
$client = static::createClient();
$entity = self::$container->get('em')->find(…, 1);
$entity->setState(1);
self::$container->get('em')->persist($entity);
self::$container->get('em')->flush();
$client->request(…, …);
@lstrojny
lstrojny / build.diff
Created Jan 30, 2018
Build difference on Symfony 3.4
View build.diff
This file has been truncated, but you can view the full file.
diff -ru dev/appDevDebugProjectContainer.php dev-old/appDevDebugProjectContainer.php
--- dev/appDevDebugProjectContainer.php 2018-01-30 17:07:56.000000000 +0100
+++ dev-old/appDevDebugProjectContainer.php 2018-01-30 17:07:31.000000000 +0100
@@ -16,6 +16,6 @@
return new \ContainerZ99qfrx\appDevDebugProjectContainer(array(
'container.build_hash' => 'Z99qfrx',
- 'container.build_id' => 'c7ecd1d9',
- 'container.build_time' => 1517328475,
View props.php
class Klass
{
private $timezone = new DateTimeZone('UTC');
private $date = new DateTime('NOW', $this->timezone);
}
View keybase.md

Keybase proof

I hereby claim:

  • I am lstrojny on github.
  • I am lstrojny (https://keybase.io/lstrojny) on keybase.
  • I have a public key ASD6MQdqO36ZDJv1hvWVMrExmNfTLt6QMWiGyjiqM7sJ_wo

To claim this, I am signing this object:

View unicode-bidi.php
<?php
function normalizeBidirectionalTextMarkers($graphemes)
{
$regex = '/
\x{202A} # LEFT-TO-RIGHT EMBEDDING
|\x{202B} # RIGHT-TO-LEFT EMBEDDING
|\x{202D} # LEFT-TO-RIGHT OVERRIDE
|\x{202E} # RIGHT-TO-LEFT OVERRIDE
|\x{202C} # POP DIRECTIONAL FORMATTING
/ux';
@lstrojny
lstrojny / capture.php
Created Dec 2, 2015
Higher order capture
View capture.php
<?php
class Connection
{
public function transactional(callable $callback)
{
$callback();
}
}
function capture(&$result, callable $callback) {
View gist:9637743
<?php
class TestCase extends PHPUnit_Framework_TestCase
{
private $dep;
private $service;
public function setUp()
{
$this->service = new Service();
View forkbomb-anatomy.txt
:(){:|:&};:
Name of the function: ":"
Function braces: "()"
Opening braces function body: "{"
Invoke function: ":"
Pass through a pipe: "|"
Pass stdout of first function call to another invocation: ":"
Background the whole thing: "&"
View gist:5784304
$ ./bin/go-go-crankin analyze --configuration gogo.xml
Building file list
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................