/** * extending hieu-le/active function * * @param array $array * * @return bool */ function if_uri_start(array $array) { if (!function_exists('if_uri') || !function_exists('if_uri_pattern')) { return false; } if (if_uri($array)) { return true; } $asterisk = function ($str) { return $str . '*'; }; return if_uri_pattern(array_map($asterisk, $array)); }
/** * @param Request $request * @param array $uri * @param $result * * @dataProvider provideCheckUriTestData */ public function testCheckCurrentUri(Request $request, array $uri, $result) { app(HttpKernelContract::class)->handle($request); $this->assertSame($result, \Active::checkUri($uri)); $this->assertSame($result, app('active')->checkUri($uri)); $this->assertSame($result, if_uri($uri)); }