1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
<?php
namespace Illuminate\Tests\Routing;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Routing\RouteAction;
use Laravel\SerializableClosure\SerializableClosure;
use PHPUnit\Framework\TestCase;
class RouteActionTest extends TestCase
{
public function test_it_can_detect_a_serialized_closure()
{
$callable = function (RouteActionUser $user) {
return $user;
};
$action = ['uses' => serialize(
new SerializableClosure($callable)
)];
$this->assertTrue(RouteAction::containsSerializedClosure($action));
$action = ['uses' => 'FooController@index'];
$this->assertFalse(RouteAction::containsSerializedClosure($action));
}
}
class RouteActionUser extends Model
{
//
}
|