function testPageWithEmpty() { $response = json_decode(JsonSchemaFixture::response('scheduled_transactions_empty.json')); $this->expect_Curl_jsonRequest()->with('GET', 'https://test.hypercharge.net/v2/scheduler/e1420438c52b4cb3a03a14a7e4fc16e1/transactions?page=3')->andReturn($response); $page = SchedulerTransactions::page('e1420438c52b4cb3a03a14a7e4fc16e1', array('page' => 3)); $this->assertIsA($page, 'Hypercharge\\PaginatedCollection'); $this->assertEqual(0, $page->getTotalCount()); $this->assertEqual(1, $page->getPage()); $this->assertEqual(50, $page->getPerPage()); $this->assertEqual(0, $page->getCount()); $this->assertEqual(0, count($page->getEntries())); }
function testTransactionsPageThrows() { try { // some valid unique_id but not a Scheduler one SchedulerTransactions::page('05c546d95938c445d037dcc7cd6aa7dd'); } catch (Errors\NetworkError $exe) { $this->assertEqual(404, $exe->http_status); $this->assertEqual(10, $exe->status_code); $this->assertEqual('The requested URL returned error: 404', $exe->technical_message); return; } $this->fail('Errors\\NetworkError expected!'); }