File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed
Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ protected function generate($ids)
5858 $ content = Cache::get ($ this ->report ->cacheKey (Report::CONTENT_CACHE_KEY_SUFFIX ));
5959
6060 foreach ($ ids as $ id ) {
61- $ this ->createPage ($ content [$ id ] ?? Data::find ($ id ))->save ();
61+ $ this ->createPage ($ content [$ id ] ?? Data::find ($ id ))? ->save();
6262 }
6363
6464 File::delete ($ this ->folderPath ());
Original file line number Diff line number Diff line change @@ -140,6 +140,41 @@ public function it_can_generate_a_large_report_with_multiple_chunked_jobs()
140140 $ this ->assertCount (10 , $ this ->files ->allFiles ($ this ->reportsPath ('1/pages ' )));
141141 }
142142
143+ /** @test */
144+ public function it_skips_over_pages_with_disabled_seo ()
145+ {
146+ $ this
147+ ->generateEntries (5 )
148+ ->generateTerms (5 );
149+
150+ $ this ->assertFileNotExists ($ this ->reportsPath ());
151+
152+ Entry::all ()->first ()->set ('seo ' , false )->save ();
153+
154+ Carbon::setTestNow ($ now = now ());
155+ Report::create ()->save ()->generate ();
156+
157+ $ expected = <<<"EXPECTED"
158+ date: $ now ->timestamp
159+ status: fail
160+ score: 76.0
161+ pages_crawled: 9
162+ results:
163+ SiteName: true
164+ UniqueTitleTag: 0
165+ UniqueMetaDescription: 9
166+ NoUnderscoresInUrl: 0
167+ ThreeSegmentUrls: 0
168+
169+ EXPECTED ;
170+
171+ $ this ->assertCount (1 , $ this ->files ->files ($ this ->reportsPath ('1 ' )));
172+ $ this ->assertEquals ($ expected , $ this ->files ->get ($ this ->reportsPath ('1/report.yaml ' )));
173+
174+ $ this ->assertFileExists ($ this ->reportsPath ('1/pages ' ));
175+ $ this ->assertCount (9 , $ this ->files ->allFiles ($ this ->reportsPath ('1/pages ' )));
176+ }
177+
143178 public function reportsPath ($ path = null )
144179 {
145180 if ($ path ) {
You can’t perform that action at this time.
0 commit comments