Skip to content

Instantly share code, notes, and snippets.

@jubianchi
Last active December 11, 2015 23:08
Show Gist options
  • Save jubianchi/4674321 to your computer and use it in GitHub Desktop.
Save jubianchi/4674321 to your computer and use it in GitHub Desktop.
<?php
namespace jubianchi {
class foo {
public function __construct($foo, $bar) {
echo $foo . '-' . $bar;
}
}
}
namespace tests\units\jubianchi {
use mageekguy\atoum;
require_once __DIR__ . '/../../vendor/autoload.php';
require_once __DIR__ . '/../../vendor/atoum/atoum/scripts/runner.php';
class foo extends atoum\test {
public function testFoo() {
$this
->mockGenerator
->orphanize('__construct')
->then
->object($object = new \mock\jubianchi\foo())
;
}
}
}
<?php
namespace jubianchi {
class foo {
public function __construct($foo, $bar) {
echo $foo . '-' . $bar;
}
}
}
namespace tests\units\jubianchi {
use mageekguy\atoum;
require_once __DIR__ . '/../../vendor/autoload.php';
require_once __DIR__ . '/../../vendor/atoum/atoum/scripts/runner.php';
class foo extends atoum\test {
public function testFoo() {
$this
->mockGenerator
->overload(new atoum\mock\php\method('__construct'))
->and($controller = new atoum\mock\controller())
->and($controller->__construct = function() {})
->then
->object($object = new \mock\jubianchi\foo($controller))
;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment