public function testStaticFindOneReturnsModelInstance() { // the return value from the find $usersData = $this->getUserData(); // mock connection methods $this->connectionMock->expects($this->once())->method('findOne')->with('users', array('email' => '*****@*****.**'))->willReturn($usersData); $user = new UserUnit(); $user->load(array('email' => '*****@*****.**')); // assertions $this->assertEquals($user->name, $usersData['name']); }