forked from roblesterjr04/EloquentSalesForce
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test for roblesterjr04#80 that addresses roblesterjr04#79
- Loading branch information
1 parent
7d6a2a6
commit e140d29
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -25,6 +26,7 @@ | |
|
||
class EloquentSalesForceTest extends TestCase | ||
{ | ||
use WithFaker; | ||
|
||
protected function getPackageProviders($app) | ||
{ | ||
|
@@ -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]']); | ||
|