/**
  * @expectedException Exception
  */
 public function testWidthIsNotInteger()
 {
     $data = ['key' => 'some-key', 'url' => 'http://google.com', 'width' => 'string'];
     $validator = new ScreenshotValidator();
     $validator->validate($data);
     $this->assertResponseStatus(400);
 }
예제 #2
0
 /**
  * Create Screenshot and Redirect to Try-Route.
  *
  * @return Illuminate\Http\RedirectResponse
  */
 public function createTestScreenshot()
 {
     $proof = trim(strtolower(Input::get('proof')));
     if ($proof != 'laravel') {
         return redirect()->route('home.landingpage');
     }
     $url = Input::get('url');
     // Validate Input
     $validator = new ScreenshotValidator();
     $validator->validate(Input::all());
     // Check if Host is available
     $checkHost = new CheckHostService();
     $checkHost->ping($url);
     // Actually Capture the Screenshot
     $screenshot = new Screenshot();
     $filename = $screenshot->generateFilename();
     $screenshot->setPath('images/try/');
     $screenshot->setStoragePath($filename);
     $screenshot->setHeight(Input::get('height'));
     $screenshot->setWidth(Input::get('width', 1024));
     $screenshot->capture($url);
     return redirect()->route('try')->with('asset', $screenshot->assetPath);
 }