Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebronner committed Sep 17, 2017
1 parent 93364a3 commit 1dfae4d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
File renamed without changes.
7 changes: 6 additions & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
$dripRoute = config('genealabs-laravel-caffeine.route', 'genealabs/laravel-caffeine/drip');
Route::get($dripRoute, Drip::class.'@drip');

Route::group(['prefix' => 'tests'], function () {
Route::group([
'middleware' => ['web'],
'as' => 'genealabs-laravel-caffeine.',
'prefix' => 'tests'
], function () {
Route::any('form', Test::class . '@drippedForm')->name('tests.form');
Route::any('dripped-form', Test::class . '@drippedForm');
Route::any('expiring-form', Test::class . '@expiredForm');
});
10 changes: 10 additions & 0 deletions tests/Feature/CaffeineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,14 @@ public function testBootstrap3TestPageCanLoad()

$response->assertStatus(204);
}

public function testMiddlewareInjectsDripScript()
{
// dd(\Route::getRoutes());
$expectedResult = "<script>setInterval(function(){var e=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject('Microsoft.XMLHTTP');e.open('GET','/genealabs/laravel-caffeine/drip',!0);e.setRequestHeader('X-Requested-With','XMLHttpRequest');e.send();}, 300000);</script>";

$response = $this->get(route('genealabs-laravel-caffeine.tests.form'));

$response->assertSee($expectedResult);
}
}

0 comments on commit 1dfae4d

Please sign in to comment.