From 1b733aec891256b745f46e1f764a195cfee5dfae Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 27 Jul 2024 10:14:48 -0400 Subject: [PATCH] refact: downlaod all leads --- .../Connectors/Zoho/Actions/DownloadAllZohoLeadAction.php | 2 +- tests/Connectors/Integration/Zoho/LeadTest.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Domains/Connectors/Zoho/Actions/DownloadAllZohoLeadAction.php b/src/Domains/Connectors/Zoho/Actions/DownloadAllZohoLeadAction.php index 5ed7eab31..f708e8b29 100644 --- a/src/Domains/Connectors/Zoho/Actions/DownloadAllZohoLeadAction.php +++ b/src/Domains/Connectors/Zoho/Actions/DownloadAllZohoLeadAction.php @@ -42,7 +42,7 @@ public function execute($totalPages = 50, $leadsPerPage = 200): Generator } $this->totalLeadsProcessed++; - yield $localLead->getId(); + yield $localLead; } } } diff --git a/tests/Connectors/Integration/Zoho/LeadTest.php b/tests/Connectors/Integration/Zoho/LeadTest.php index 7f9ed0a23..739ea4182 100644 --- a/tests/Connectors/Integration/Zoho/LeadTest.php +++ b/tests/Connectors/Integration/Zoho/LeadTest.php @@ -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; @@ -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()); }