Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pager->current() breaking when no data #378

Merged
merged 1 commit into from
Oct 26, 2018

Conversation

aaron-junot
Copy link

Fixes #354

Script:

  // 'account' should be a valid account with canceled subscriptions but no live subscriptions
  $subscriptions = Recurly_SubscriptionList::getForAccount('account', ['state' => 'live']);
  print $subscriptions->count() . "\n";
  $sub = $subscriptions->current();
  var_dump($sub);

Before this commit, this script would throw an exception. Now it prints

0
NULL

@bhelx bhelx removed their request for review October 25, 2018 21:01
@@ -115,4 +115,14 @@ public function testFromNested() {
$this->assertIteratesCorrectly($pager, 4);
$this->assertEquals(4, count($pager), 'Count is unchanged after iterating');
}

public function testEmptyCollection() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit pick but since this kind of tags on to the Nested case above what do you think about testFromEmptyNested() or testEmptyNested()?

Tests/Recurly/Pager_Test.php Show resolved Hide resolved
@drewish drewish merged commit 0a53d33 into master Oct 26, 2018
@drewish drewish deleted the aaron-suarez/fix-pager-current branch October 26, 2018 21:06
@bhelx bhelx added the V2 V2 Client label Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
V2 V2 Client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Recurly_Pager->current() breaks if the returned data is empty
3 participants