Skip to content

Commit

Permalink
refact: downlaod all leads
Browse files Browse the repository at this point in the history
  • Loading branch information
kaioken committed Jul 27, 2024
1 parent 7720150 commit 1b733ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function execute($totalPages = 50, $leadsPerPage = 200): Generator
}

$this->totalLeadsProcessed++;
yield $localLead->getId();
yield $localLead;
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions tests/Connectors/Integration/Zoho/LeadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Kanvas\Guild\Enums\FlagEnum;
use Kanvas\Guild\Leads\Actions\CreateLeadReceiverAction;
use Kanvas\Guild\Leads\DataTransferObject\LeadReceiver;
use Kanvas\Guild\Leads\Models\Lead;
use Kanvas\Guild\Support\Setup;
use Tests\TestCase;

Expand Down Expand Up @@ -50,6 +51,10 @@ public function testDownloadAllLeads(): void

$leads = $downloadAllLeads->execute(totalPages: 1, leadsPerPage: 1);

foreach ($leads as $lead) {
$this->assertInstanceOf(Lead::class, $lead);
}

$this->assertIsArray(iterator_to_array($leads));
$this->assertEquals(1, $downloadAllLeads->getTotalLeadsProcessed());
}
Expand Down

0 comments on commit 1b733ae

Please sign in to comment.