public function testGetCallsFileGetContentsWithUserId() { $fileGetContents = \idfly\Moka::spy('"USER"'); $userData = new UserData($fileGetContents); $userData->get(1000); $this->assertEquals(['/data/1000.json'], $fileGetContents->report()[0]); }
public function testMainCallsFind() { $userClass = \idfly\Moka::stubClass(null, ['::find' => 'USER']); $controller = new UsersController($userClass); $controller->find(1000); // check that `find` was called with 100 $this->assertEquals([1000], $userClass::$moka->report('find')[0]); }
public function setUp() { $this->_stubs = \idfly\Moka::stub(null, ['report' => 'REPORT', 'stubs' => 'STUBS', 'invoke' => 'INVOKE']); $this->_object = new Spy('__UNDEFINED__', ['stubs' => $this->_stubs]); }
/** * Adjust spy behaviour */ public function testSpyHasReport() { $spy = \idfly\Moka::spy('DEFAULT'); $spy->stubs()->with('ARG')->returns('RESULT'); $this->assertEquals('RESULT', $spy('ARG')); }
public function testStubHasParent() { $class = \idfly\Moka::stubClass(self::HELPER, []); $this->assertInstanceOf(self::HELPER, new $class()); }