Ensure that the winners are comments
This commit is contained in:
parent
4292cc3147
commit
fa56cf6908
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Tests\Service;
|
namespace App\Tests\Service;
|
||||||
|
|
||||||
|
use App\Comment;
|
||||||
use App\Service\Picker;
|
use App\Service\Picker;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Tightenco\Collect\Support\Collection;
|
use Tightenco\Collect\Support\Collection;
|
||||||
|
@ -125,12 +126,17 @@ class PickerTest extends TestCase
|
||||||
|
|
||||||
tap($picker->getWinners(1), function (Collection $winners) use ($picker) {
|
tap($picker->getWinners(1), function (Collection $winners) use ($picker) {
|
||||||
$this->assertCount(1, $winners);
|
$this->assertCount(1, $winners);
|
||||||
|
$this->assertInstanceOf(Comment::class, $winners->first());
|
||||||
$this->assertTrue($picker->getComments()->contains($winners->first()));
|
$this->assertTrue($picker->getComments()->contains($winners->first()));
|
||||||
});
|
});
|
||||||
|
|
||||||
tap($picker->getWinners(2), function (Collection $winners) use ($picker) {
|
tap($picker->getWinners(2), function (Collection $winners) use ($picker) {
|
||||||
$this->assertCount(2, $winners);
|
$this->assertCount(2, $winners);
|
||||||
|
|
||||||
|
$this->assertInstanceOf(Comment::class, $winners->first());
|
||||||
$this->assertTrue($picker->getComments()->contains($winners->first()));
|
$this->assertTrue($picker->getComments()->contains($winners->first()));
|
||||||
|
|
||||||
|
$this->assertInstanceOf(Comment::class, $winners->last());
|
||||||
$this->assertTrue($picker->getComments()->contains($winners->last()));
|
$this->assertTrue($picker->getComments()->contains($winners->last()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue