Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
staudenmeir committed Apr 26, 2019
1 parent 7dde63e commit b7be672
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/BelongsToThroughTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Tests;

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Arr;
use Tests\Models\Comment;

Expand All @@ -12,7 +13,9 @@ public function testLazyLoading()
$country = Comment::first()->country;

$this->assertEquals(1, $country->id);
$this->assertEquals(1, $country->users_count);
if (method_exists(Builder::class, 'withCount')) {
$this->assertEquals(1, $country->users_count);
}
}

public function testLazyLoadingWithSingleThroughModel()
Expand Down Expand Up @@ -50,7 +53,9 @@ public function testEagerLoading()
$this->assertEquals(1, $comments[0]->country->id);
$this->assertEquals(2, $comments[1]->country->id);
$this->assertNull($comments[2]->country);
$this->assertEquals(1, $comments[0]->country->users_count);
if (method_exists(Builder::class, 'withCount')) {
$this->assertEquals(1, $comments[0]->country->users_count);
}
}

public function testEagerLoadingWithPrefix()
Expand Down

0 comments on commit b7be672

Please sign in to comment.