public function testFindReturnsModel() { $stub = Mockery::mock('PullAutomaticallyGalleries\\RemoteApi\\RemoteApiModelInterface')->shouldReceive('setAuth')->with(['foo'])->once()->andReturn(Mockery::self())->shouldReceive('find')->with('1')->once()->andReturn($this->galleryStub)->getMock(); $mock = Test::double('RemoteGallery', ['newModel' => $stub]); $gallery = RemoteGallery::find('DummyHost', ['foo'], '1'); $mock->verifyInvoked('setHost'); $mock->verifyInvoked('newModel'); $mock->verifyInvoked('modifyAttributes'); assertThat($gallery, is(objectValue())); }
public function testVerifyCredentialsGetsData() { $stub = Mockery::mock('PullAutomaticallyGalleries\\RemoteApi\\RemoteApiModelInterface')->shouldReceive('verifyCredentials')->with(['dummy-credentials'])->andReturn($this->userStub)->getMock(); $mock = Test::double('RemoteUser', ['newModel' => $stub]); $user = RemoteUser::verifyCredentials('DummyHost', ['dummy-credentials']); $mock->verifyInvoked('setHost'); $mock->verifyInvoked('newModel'); $mock->verifyInvoked('verifyCredentials'); $mock->verifyInvoked('modifyAttributes'); assertThat($user, is(objectValue())); }
public function testDecribesActualTypeInMismatchMessage() { $this->assertMismatchDescription('was null', objectValue(), null); $this->assertMismatchDescription('was a string "foo"', objectValue(), 'foo'); }
public function testConstructSetsCache() { $model = new ApiModelStub(); $plugins = $model->getPlugins(); assertThat($plugins['cache'], is(objectValue())); }