Permalink
Browse files

Testing view content

  • Loading branch information...
REBELinBLUE committed Feb 13, 2017
1 parent 18c27d6 commit 6ac2a262334a530146095cb7576bc755e82d2d0d
Showing with 18 additions and 9 deletions.
  1. +9 −0 app/Providers/UpdateServiceProvider.php
  2. +0 −3 bootstrap/autoload.php
  3. +9 −6 tests/Feature/Admin/GroupControllerTest.php
@@ -13,6 +13,15 @@
**/
class UpdateServiceProvider extends ServiceProvider
{
+ /**
+ * Bootstrap any application services.
+ */
+ public function boot()
+ {
+ // Define a constant for the application version
+ define('APP_VERSION', trim(file_get_contents(__DIR__ . '/../../VERSION')));
+ }
+
/**
* Register the application services.
*/
View
@@ -2,9 +2,6 @@
define('LARAVEL_START', microtime(true));
-// Define a constant for the application version
-define('APP_VERSION', trim(file_get_contents(__DIR__ . '/../VERSION')));
-
/*
|--------------------------------------------------------------------------
| Register The Composer Auto Loader
@@ -31,12 +31,15 @@ public function setUp()
*/
public function testIndex()
{
- // FIXME: How do I test this?
- //$groups = app(GroupRepositoryInterface::class)->getAll();
-
$response = $this->get('/admin/groups');
$response->assertStatus(Response::HTTP_OK)->assertViewHas(['title', 'groups']);
+
+ /** @var \Robbo\Presenter\View\View $json */
+ $view = $response->getOriginalContent();
+ $groups = app(GroupRepositoryInterface::class)->getAll();
+
+ $this->assertSame($groups->toJson(), $view->groups->toJson());
}
/**
@@ -93,9 +96,9 @@ public function testUpdateUpdatesGroup()
}
/**
- * @covers ::__construct
- * @covers ::update
- */
+ * @covers ::__construct
+ * @covers ::update
+ */
public function testUpdateValidates()
{
factory(Group::class)->create(['name' => 'Foo']);

0 comments on commit 6ac2a26

Please sign in to comment.