Esempio n. 1
0
 /**
  * Test handle
  *
  * @return void
  */
 public function testHandle()
 {
     $inspectionFaker = factory(Inspection::class)->create();
     factory(Url::class, 5)->create(['project_id' => $inspectionFaker->project->id]);
     $project = Mockery::mock(Project::class);
     $generator = Mockery::mock(CommandLineGenerator::class . '[generateCommand]', [new Scope()]);
     $job = Mockery::mock(JobInspect::class . '[newInstance, save]')->makePartial();
     $project->shouldReceive('urls->active->byType->get')->andReturn(2);
     $generator->shouldReceive('getByType')->andReturn(new Collection([Scope::find(1)]));
     $generator->shouldReceive('generateCommand')->andReturn(1);
     $job->shouldReceive('newInstance')->andReturn($job);
     $job->shouldReceive('save')->andReturn(true);
     $listener = new JobGenerator($generator, $job);
     $listener->handle(new ProjectWatcher($inspectionFaker->project, $inspectionFaker));
 }
Esempio n. 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $seoCheckingList = ['Title Tag Checking' => '--title', 'Header Tag Checking' => '--header', 'Footer Tag Checking' => '--footer', 'Favicon Checking' => '--favicon', 'ARIA Landmark Checking' => '--aria', 'Alt Text on Image' => '--noalt', 'Internationalization - i18n' => '--i18n', 'Necessary Meta Tag Checking' => '--meta', 'Heading (h1) checking' => '--heading'];
     $backendSeoCheckingList = ['Title Tag Similarity Checking' => '--title-similar', 'Meta Tag Description Similarity Checking' => '--desc-similar', 'Url Depth Checking' => '--depth'];
     $socialMediaCheckingList = ['Open Graph Protocol' => '--opengraph', 'Twitter Cards' => '--twittercard', 'Facebook Insights' => '--facebookinsight'];
     $standAloneChecker = ['HTML Validation by W3 Validator' => 'html', 'CSS Validation by CSSLint' => 'css', 'JS Validation by JSHint' => 'js', 'Google Page Speed - Mobile' => 'gPagespeedMobile', 'Google Page Speed - Desktop' => 'gPagespeedDesktop', 'Yahoo YSlow' => 'ySlow'];
     $scope = Scope::getByName('seo');
     foreach ($seoCheckingList as $name => $parameter) {
         $this->addNewSubSopes($scope, $name, $parameter);
     }
     $scope = Scope::getByName('backendSeo');
     foreach ($backendSeoCheckingList as $name => $parameter) {
         $this->addNewSubSopes($scope, $name, $parameter);
     }
     foreach ($standAloneChecker as $name => $parameter) {
         $scope = Scope::getByName($parameter);
         $this->addNewSubSopes($scope, $name, '');
     }
     $scope = Scope::getByName('socialMedia');
     foreach ($socialMediaCheckingList as $name => $parameter) {
         $this->addNewSubSopes($scope, $name, $parameter);
     }
 }
Esempio n. 3
0
 /**
  * Test get query scope of byCategorySlug method
  *
  * @return void
  */
 public function testScopeByCategorySlug()
 {
     $scope = new Scope();
     $this->assertInstanceOf(Collection::class, $scope->byCategorySlug(1)->get());
 }
Esempio n. 4
0
 /**
  * Test to run ySlowResultReader method and catch exception
  *
  * @return void
  */
 public function testRunYslowResultReaderCatchException()
 {
     $jobFaker = factory(JobInspect::class)->create(['command_line' => 'nodejs --url http://example.com --destination /public/files/example/1/url-1/', 'scope_id' => Scope::where('id', 9)->first()->id]);
     $decoder = Mockery::mock(JsonDecoder::class . '[decodeFile]');
     $issue = Mockery::mock(Issue::class);
     $reader = new ResultReader($decoder, $issue);
     $decoder->shouldReceive('decodeFile')->andThrow(new FileNotFoundException());
     $reader->setJob($jobFaker);
     $this->assertTrue($reader->ySlowResultReader('example.json'));
 }