-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/add-browserkit-testing' into develop
- Loading branch information
Showing
9 changed files
with
85 additions
and
12 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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php namespace GeneaLabs\LaravelModelCaching\Tests\Browser; | ||
|
||
use GeneaLabs\LaravelModelCaching\Tests\FeatureTestCase; | ||
use GeneaLabs\LaravelModelCaching\Tests\Fixtures\Book; | ||
|
||
class PaginationTest extends FeatureTestCase | ||
{ | ||
public function testPaginationProvidesDifferentLinksOnDifferentPages() | ||
{ | ||
$book = (new Book) | ||
->take(11) | ||
->get() | ||
->last(); | ||
$page1 = $this->visit("pagination-test"); | ||
|
||
$this->assertTrue(str_contains($page1->response->getContent(), '<li class="page-item active"><span class="page-link">1</span></li>')); | ||
|
||
$page2 = $page1->click("2"); | ||
|
||
$this->assertTrue(str_contains($page2->response->getContent(), '<li class="page-item active"><span class="page-link">2</span></li>')); | ||
$page2->see($book->title); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php namespace GeneaLabs\LaravelModelCaching\Tests; | ||
|
||
use Orchestra\Testbench\BrowserKit\TestCase as BaseTestCase; | ||
|
||
abstract class FeatureTestCase extends BaseTestCase | ||
{ | ||
use CreatesApplication; | ||
} |
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
22 changes: 22 additions & 0 deletions
22
tests/resources/views/model-caching-tests/pagination.blade.php
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<table> | ||
|
||
@foreach ($books as $book) | ||
<tr> | ||
<td> | ||
{{ $book->id }} | ||
</td> | ||
<td> | ||
{{ $book->title }} | ||
</td> | ||
</tr> | ||
@endforeach | ||
|
||
</table> | ||
|
||
{{ $books->links() }} | ||
|
||
</body> | ||
</html> |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
use GeneaLabs\LaravelModelCaching\Tests\Fixtures\Book; | ||
|
||
Route::get('pagination-test', function () { | ||
$books = (new Book) | ||
->paginate(10); | ||
|
||
return view("model-caching-tests.pagination") | ||
->with(compact( | ||
'books' | ||
)); | ||
}); |