Skip to content

Commit 90eed83

Browse files
committed
fix(php-version) : remove php7 specific code to make 1.0 compatible with php 5.6
1 parent 36ec815 commit 90eed83

File tree

6 files changed

+30
-27
lines changed

6 files changed

+30
-27
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
language: php
22

33
php:
4+
- 5.6
45
- 7.1
56

67
sudo: false

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
},
2727
"require-dev": {
2828
"mockery/mockery": "~0.9",
29-
"orchestra/database": "~3.0",
30-
"orchestra/testbench" : "~3.0",
31-
"phpunit/phpunit": "~6.0"
29+
"orchestra/database": "~3.4",
30+
"orchestra/testbench" : "~3.4",
31+
"phpunit/phpunit": "~5.7"
3232
},
3333
"suggest": {
3434
"nexmo/client": "Required for sms notifications."

src/Console/Commands/ListSchedule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected function upcoming($event)
8282
if ($event->timezone) {
8383
$date->setTimezone($event->timezone);
8484
}
85-
86-
return (CronExpression::factory($event->expression)->getNextRunDate($date->toDateTimeString()))->format('Y-m-d H:i:s');
85+
$expression = CronExpression::factory($event->expression)->getNextRunDate($date->toDateTimeString());
86+
return $expression->format('Y-m-d H:i:s');
8787
}
8888
}

src/Totem.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ class Totem
2121
*/
2222
public static function check($request)
2323
{
24-
return (static::$authUsing ?: function () {
24+
$callback = static::$authUsing ?: function () {
2525
return app()->environment('local');
26-
})($request);
26+
};
27+
return $callback($request);
2728
}
2829

2930
/**

tests/Feature/AuthTest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Studio\Totem\Tests\Feature;
44

5+
use Illuminate\Http\Request;
56
use Studio\Totem\Totem;
67
use Studio\Totem\Tests\TestCase;
78
use Studio\Totem\Http\Middleware\Authenticate;
@@ -30,10 +31,9 @@ public function auth_middleware_works()
3031
});
3132

3233
$middleware = new Authenticate;
33-
34+
$object = new Request;
3435
$response = $middleware->handle(
35-
new class {
36-
},
36+
$object,
3737
function ($value) {
3838
return 'response';
3939
}
@@ -53,10 +53,9 @@ public function auth_middleware_responds_with_403_on_failure()
5353
});
5454

5555
$middleware = new Authenticate;
56-
56+
$object = new Request;
5757
$response = $middleware->handle(
58-
new class {
59-
},
58+
$object,
6059
function ($value) {
6160
return 'response';
6261
}

tests/TestCase.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,7 @@ protected function getPackageProviders($app)
5252
*/
5353
protected function disableExceptionHandling()
5454
{
55-
$this->app->instance(ExceptionHandler::class, new class extends Handler {
56-
public function __construct()
57-
{
58-
}
59-
60-
public function report(Exception $e)
61-
{
62-
}
63-
64-
public function render($request, Exception $e)
65-
{
66-
throw $e;
67-
}
68-
});
55+
app()->instance(ExceptionHandler::class, new PassThroughHandler);
6956

7057
return $this;
7158
}
@@ -84,3 +71,18 @@ public function signIn()
8471
return $this;
8572
}
8673
}
74+
75+
class PassThroughHandler extends Handler
76+
{
77+
public function __construct()
78+
{
79+
}
80+
public function report(Exception $e)
81+
{
82+
// no-op
83+
}
84+
public function render($request, Exception $e)
85+
{
86+
throw $e;
87+
}
88+
}

0 commit comments

Comments
 (0)