function testEachWithEmpty() { $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); $_this = $this; SchedulerTransactions::each('e1420438c52b4cb3a03a14a7e4fc16e1', array('page' => 3), function ($trx) use($_this) { $_this->fail('callback should not be called!'); }); }
function testTransactionsEachThrows() { try { $_this = $this; // some valid unique_id but not a Scheduler one SchedulerTransactions::each('05c546d95938c445d037dcc7cd6aa7dd', array(), function ($transaction) use($_this) { $_this->fail('callback should never be called!'); }); } 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!'); }