public function testGetPins() { $response = $this->createPaginatedResponse(); $this->mock->expects($this->at(0))->method('exec')->willReturn($response); $this->mock->expects($this->at(1))->method('exec')->willReturn(['resource_response' => ['data' => []]]); $this->mock->expects($this->at(2))->method('exec')->willReturn(['resource_response' => ['data' => [['type' => 'module']]]]); $pins = $this->provider->pins(1); $this->assertCount(2, iterator_to_array($pins)[0]); $pins = $this->provider->pins(0); $this->assertEmpty(iterator_to_array($pins)); }
/** @test */ public function createBoard() { $response = $this->createSuccessApiResponse(); $error = $this->createErrorApiResponse(); $this->mock->shouldReceive('exec')->once()->andReturn($response); $this->mock->shouldReceive('exec')->once()->andReturn($error); $this->assertTrue($this->provider->create('test', 'test')); $this->assertFalse($this->provider->delete('test', 'test')); }
/** @test */ public function it_should_return_title_suggestions_for_pin() { $suggestions = ['Board1', 'Board2']; $this->apiShouldReturnData($suggestions)->assertEquals($suggestions, $this->provider->titleSuggestionsFor(12345)); $this->apiShouldReturnError()->assertFalse($this->provider->titleSuggestionsFor(12345)); }