Skip to content

Commit

Permalink
test for roblesterjr04#80 that addresses roblesterjr04#79
Browse files Browse the repository at this point in the history
  • Loading branch information
nickturrietta committed Dec 6, 2021
1 parent 7d6a2a6 commit e140d29
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/EloquentSalesForceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use PHPUnit\Framework\Error\Notice;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Foundation\Testing\WithFaker;
use Forrest;
use GuzzleHttp\Client;
use Carbon\Carbon;
Expand All @@ -25,6 +26,7 @@

class EloquentSalesForceTest extends TestCase
{
use WithFaker;

protected function getPackageProviders($app)
{
Expand Down Expand Up @@ -615,6 +617,39 @@ public function testSoftDeletes()

}

public function testCursorWithSoftDeletes()
{
$leadOne = TestLead::create(['FirstName' => $this->faker->firstName(), 'LastName' => $this->faker->lastName(), 'Company' => $this->faker->company(), 'Email' => $this->faker->email()]);

$leadTwo = TestLead::create(['FirstName' => $this->faker->firstName(), 'LastName' => $this->faker->lastName(), 'Company' => $this->faker->company(), 'Email' => $this->faker->email()]);


$leadsByGetCount = TestLead::get()->count();
$leadsByCursorCount = TestLead::cursor()->count();
$this->assertEquals($leadsByGetCount, $leadsByCursorCount);

$allLeadsByGetCount = TestLead::withTrashed()->get()->count();
$allLeadsByCursorCount = TestLead::withTrashed()->cursor()->count();
$this->assertEquals($allLeadsByGetCount, $allLeadsByCursorCount);

$onlyTrashedLeadsByGetCount = TestLead::onlyTrashed()->get()->count();
$onlyTrashedLeadsByCursorCount = TestLead::onlyTrashed()->cursor()->count();
$this->assertEquals($onlyTrashedLeadsByGetCount, $onlyTrashedLeadsByCursorCount);


$leadOne->delete();

$newLeadsByCursorCount = TestLead::cursor()->count();
$this->assertEquals($leadsByCursorCount-1, $newLeadsByCursorCount);

$newAllLeadsByCursorCount = TestLead::withTrashed()->cursor()->count();
$this->assertEquals($allLeadsByCursorCount, $newAllLeadsByCursorCount);

$newOnlyTrashedLeadsByCursorCount = TestLead::onlyTrashed()->cursor()->count();
$this->assertEquals($onlyTrashedLeadsByCursorCount+1, $newOnlyTrashedLeadsByCursorCount);

}

public function testReplicate()
{
$lead = TestLead::create(['FirstName' => 'Rob', 'LastName' => 'Lester', 'Company' => 'Test', 'Email' => '[email protected]']);
Expand Down

0 comments on commit e140d29

Please sign in to comment.