From 2985b939fd7ec8cd80c6e832588f92ce65b3e1da Mon Sep 17 00:00:00 2001 From: Faiber Rodriguez Date: Thu, 1 Feb 2024 16:52:27 -0500 Subject: [PATCH] test for list --- .../Recurly/GeneralLedgerAccountList_Test.php | 36 +++++++++++++++++++ ...0-liability.xml => list-200-liability.xml} | 0 ...x-200-revenue.xml => list-200-revenue.xml} | 0 .../{index-200.xml => list-200.xml} | 4 +-- lib/recurly/general_ledger_account_list.php | 2 +- 5 files changed, 39 insertions(+), 3 deletions(-) rename Tests/fixtures/general_ledger_accounts/{index-200-liability.xml => list-200-liability.xml} (100%) rename Tests/fixtures/general_ledger_accounts/{index-200-revenue.xml => list-200-revenue.xml} (100%) rename Tests/fixtures/general_ledger_accounts/{index-200.xml => list-200.xml} (98%) diff --git a/Tests/Recurly/GeneralLedgerAccountList_Test.php b/Tests/Recurly/GeneralLedgerAccountList_Test.php index e69de29b..eff506e2 100644 --- a/Tests/Recurly/GeneralLedgerAccountList_Test.php +++ b/Tests/Recurly/GeneralLedgerAccountList_Test.php @@ -0,0 +1,36 @@ +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); + } +} diff --git a/Tests/fixtures/general_ledger_accounts/index-200-liability.xml b/Tests/fixtures/general_ledger_accounts/list-200-liability.xml similarity index 100% rename from Tests/fixtures/general_ledger_accounts/index-200-liability.xml rename to Tests/fixtures/general_ledger_accounts/list-200-liability.xml diff --git a/Tests/fixtures/general_ledger_accounts/index-200-revenue.xml b/Tests/fixtures/general_ledger_accounts/list-200-revenue.xml similarity index 100% rename from Tests/fixtures/general_ledger_accounts/index-200-revenue.xml rename to Tests/fixtures/general_ledger_accounts/list-200-revenue.xml diff --git a/Tests/fixtures/general_ledger_accounts/index-200.xml b/Tests/fixtures/general_ledger_accounts/list-200.xml similarity index 98% rename from Tests/fixtures/general_ledger_accounts/index-200.xml rename to Tests/fixtures/general_ledger_accounts/list-200.xml index c78664e2..c9d66e64 100644 --- a/Tests/fixtures/general_ledger_accounts/index-200.xml +++ b/Tests/fixtures/general_ledger_accounts/list-200.xml @@ -1,7 +1,7 @@ HTTP/1.1 200 OK - Content-Type: application/xml; charset=utf-8 +Content-Type: application/xml; charset=utf-8 - + u90r5deeaxix diff --git a/lib/recurly/general_ledger_account_list.php b/lib/recurly/general_ledger_account_list.php index 4ba4bed3..d65e6e66 100644 --- a/lib/recurly/general_ledger_account_list.php +++ b/lib/recurly/general_ledger_account_list.php @@ -13,6 +13,6 @@ public static function getByAccountType($account_type, $client = null) { } protected function getNodeName() { - return 'general_ledger_accounts'; + return 'general_ledger_accounts'; } }