Skip to content

Instantly share code, notes, and snippets.

Avatar

Phil Bennett philipobenito

  • Barnsley, Yorkshire, England
View GitHub Profile
View init.coffee
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
View merged_branches.sh
# don't recommend running as one script
# list merged remote branches
git branch -a --merged live | grep -v live
# delete remote merged branches
git branch -a --merged live | grep -v live | xargs -n 1 git push --delete origin
# list merged local branches
git branch --merged live | grep -v live
View dependency-injection-as-a-tool-for-testing-mock.php
<?php
class FooTest extends PHPUnit_Framework_Testcase
{
public function testDoSomethingEditsDataAndReturnsArray()
{
$foo = new Foo;
$user = [
'name' => 'Phil',
View dependency-injection-as-a-tool-for-testing-stub.php
<?php
class FooTest extends PHPUnit_Framework_Testcase
{
public function testDoSomethingEditsDataAndReturnsArray()
{
$foo = new Foo;
$user = [
'name' => 'Phil',
View dependency-injection-as-a-tool-for-testing-fake.php
<?php
class FakeBar
{
public $users = [
1 => [
'name' => 'Adam',
'email' => 'adam@example.com'
]
];
View dependency-injection-as-a-tool-for-testing-inject-bar-test.php
<?php
class FooTest extends PHPUnit_Framework_Testcase
{
public function testDoSomethingEditsDataAndReturnsArray()
{
$foo = new Foo;
$bar = new Bar;
$user = $foo->doSomething($bar, 1, , 'Phil', 'hello@example.com');
View dependency-injection-as-a-tool-for-testing-inject-bar.php
<?php
class Foo
{
protected $bar;
public function doSomething($bar, $id, $name, $email)
{
$this->bar = $bar;
// .. possibly manipulate $id, $name and $email
View dependency-injection-as-a-tool-for-testing-a-unit.php
<?php
class Foo
{
public function doSomething($id, $name, $email)
{
$bar = new Bar;
// .. possibly manipulate $id, $name and $email
View gist:f2b5fb0685e211036852
Verifying that +philipobenito is my blockchain ID. https://onename.com/philipobenito
View example.php
<?php
$container = new League\Container\Container;
$container->add('Zend\Diactoros\ServerRequest', function () {
return Zend\Diactoros\ServerRequestFactory::fromGlobals(
$_SERVER,
$_GET,
$_POST,
$_COOKIE,