Skip to content

Commit

Permalink
test for list
Browse files Browse the repository at this point in the history
  • Loading branch information
faiberrec committed Feb 1, 2024
1 parent e74a73a commit 2985b93
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 3 deletions.
36 changes: 36 additions & 0 deletions Tests/Recurly/GeneralLedgerAccountList_Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

class Recurly_GeneralLedgerAccountListTest extends Recurly_TestCase
{
public function testGetGeneralLedgerAccountListAll() {
$this->client->addResponse(
'GET',
'/general_ledger_accounts',
'general_ledger_accounts/list-200.xml'
);

$general_ledger_accounts = Recurly_GeneralLedgerAccountList::get(null, $this->client);
$this->assertInstanceOf('Recurly_GeneralLedgerAccountList', $general_ledger_accounts);

$general_ledger_account = $general_ledger_accounts->current();
$this->assertInstanceOf('Recurly_GeneralLedgerAccount', $general_ledger_account);

$this->assertEquals(iterator_count($general_ledger_accounts), 3);
}

public function testGetGeneralLedgerAccountListFiltered() {
$this->client->addResponse(
'GET',
'/general_ledger_accounts?account_type=revenue',
'general_ledger_accounts/list-200-revenue.xml'
);

$general_ledger_accounts = Recurly_GeneralLedgerAccountList::getByAccountType('revenue', $this->client);
$this->assertInstanceOf('Recurly_GeneralLedgerAccountList', $general_ledger_accounts);

$general_ledger_account = $general_ledger_accounts->current();
$this->assertInstanceOf('Recurly_GeneralLedgerAccount', $general_ledger_account);

$this->assertEquals(iterator_count($general_ledger_accounts), 2);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
HTTP/1.1 200 OK
Content-Type: application/xml; charset=utf-8
Content-Type: application/xml; charset=utf-8

<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<general_ledger_accounts type="array">
<general_ledger_account href="https://api.recurly.com/v2/general_ledger_accounts/u90r5deeaxix">
<id>u90r5deeaxix</id>
Expand Down
2 changes: 1 addition & 1 deletion lib/recurly/general_ledger_account_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ public static function getByAccountType($account_type, $client = null) {
}

protected function getNodeName() {
return 'general_ledger_accounts';
return 'general_ledger_accounts';
}
}

0 comments on commit 2985b93

Please sign in to comment.