public function testGetList($plan)
{
$result = Plan::all(array('page_size' => '20', 'total_required' => 'yes'), $this->apiContext, $this->mockPayPalRestCall);
$this->assertNotNull($result);
$totalPages = $result->getTotalPages();
$found = false;
$foundObject = null;
do {
foreach ($result->getPlans() as $obj) {
if ($obj->getId() == $plan->getId()) {
$found = true;
$foundObject = $obj;
break;
}
}
if (!$found) {
$result = Plan::all(array('page' => --$totalPages, 'page_size' => '20', 'total_required' => 'yes'), $this->apiContext, $this->mockPayPalRestCall);
}
} while ($totalPages > 0 && $found == false);
$this->assertTrue($found, "The Created Plan was not found in the get list");
$this->assertEquals($plan->getId(), $foundObject->getId());
}