public function before() { $this->foo = new Mockster(CheckReturnTypeTest_FooClass::class); $this->mock = $this->foo->__mock(); $this->uut = $this->foo->__uut(); }
function testPropertyStubbingOverwritesArgumentsStubbing() { /** @var Mockster|InjectMocksTest_InjectableClass $injectable */ $injectable = new Mockster(InjectMocksTest_InjectableClass::class); /** @var Mockster|InjectMocksTest_FooClass $injected */ $injected = new Mockster(InjectMocksTest_FooClass::class); Mockster::stub($injected->foo())->will()->return_('argument'); Mockster::stub($injectable->bas->foo())->will()->return_('property'); /** @var InjectMocksTest_InjectableClass $mock */ $mock = $injectable->__uut(['bas' => $injected->__mock()]); $this->assert($mock->bas->foo(), 'property'); }
function testPassConstructorArgumentsByName() { $this->mock = $this->foo->__uut(['one' => 'uno', 'two' => 'dos']); $this->assert($this->mock->constructorArguments, ['uno', 'dos']); }