Ejemplo n.º 1
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $response = $next($request);
     $cookie = Ab::saveSession();
     if (method_exists($response, 'withCookie')) {
         return $response->withCookie(cookie()->forever(config('laravel-ab.cache_key'), $cookie));
     }
     return $response;
 }
Ejemplo n.º 2
0
 public function testMetaDataStorage()
 {
     include 'source/helper.php';
     $meta = laravel_ab_meta();
     Session::forget(config('laravel-ab.cache_key'));
     Session::flush();
     $ab = app()->make('Ab');
     $ab->forceReset();
     Ab::saveSession();
     $instance = Instance::where(['instance' => Ab::getSession()->instance])->get()->first();
     $metadata = $instance->metadata;
     $this->assertTrue(is_array($metadata));
     $this->assertEquals($metadata, $meta);
 }