Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a342f2e

Browse files
Add tests for application handler functionality
1 parent 0b58d39 commit a342f2e

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

‎app/Http/Controllers/HomeController.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,14 @@ public function serviceContainer()
151151
return view('service-container');
152152
}
153153

154+
/**
155+
* @return string
156+
*/
157+
public function testValue()
158+
{
159+
return 'Test value is ' . config('test_value');
160+
}
161+
154162
/**
155163
* @param \Illuminate\Http\Request $request
156164
* @return string

‎app/Http/routes.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
Route::get('fire-event', 'HomeController@fireEvent');
2727
Route::get('validation', 'HomeController@validation');
2828
Route::get('service-container', 'HomeController@serviceContainer');
29+
Route::get('test-value', 'HomeController@testValue');
2930
Route::post('upload', 'HomeController@upload');
3031
Route::match(['get', 'post'], 'form', 'HomeController@form');
3132

‎app/Providers/ConfigServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ConfigServiceProvider extends ServiceProvider {
1616
public function register()
1717
{
1818
config([
19-
//
19+
'test_value' => 5,
2020
]);
2121
}
2222

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
$I = new FunctionalTester($scenario);
3+
4+
$I->haveApplicationHandler(function($app) {
5+
$app->make('config')->set(['test_value' => 10]);
6+
});
7+
$I->sendGET('/test-value');
8+
$I->see('Test value is 10');
9+
10+
$I->haveApplicationHandler(function($app) {
11+
$app->make('config')->set(['test_value' => 15]);
12+
});
13+
$I->sendGET('/test-value');
14+
$I->see('Test value is 15');
15+
16+
$I->clearApplicationHandlers();
17+
$I->sendGET('/test-value');
18+
$I->see('Test value is 5'); // 5 is the default value

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /