File tree Expand file tree Collapse file tree 2 files changed +19
-6
lines changed
tests/Integration/Commands Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,11 @@ public function handle(): void
4747
4848 protected function shouldBeSynced (Article $ article ): bool
4949 {
50- if ($ article ->hero_image && ! $ article ->hasHeroImage ()) {
50+ if (!$ article ->hero_image ) {
51+ return false ;
52+ }
53+
54+ if ($ article ->hero_image && $ article ->hasHeroImage ()) {
5155 return false ;
5256 }
5357
Original file line number Diff line number Diff line change 1010uses (DatabaseMigrations::class);
1111
1212
13- test ('hero image url is updated for published articles with hero image ' , function () {
13+ test ('hero image url and author information is updated for published articles with hero image ' , function () {
1414 Http::fake (function () {
1515 return [
1616 'urls ' => [
1717 'raw ' => 'https://images.unsplash.com/photo-1584824486509-112e4181ff6b?ixid=M3w2NTgwOTl8MHwxfGFsbHx8fHx8fHx8fDE3Mjc2ODMzMzZ8&ixlib=rb-4.0.3 '
18- ]
18+ ],
19+ 'user ' => [
20+ 'name ' => 'Erik Mclean ' ,
21+ 'links ' => [
22+ 'html ' => 'https://unsplash.com/@introspectivedsgn ' ,
23+ ]
24+ ],
1925 ];
2026 });
2127
2935
3036 $ article ->refresh ();
3137
32- expect ($ article ->heroImage ())->toBeUrl ();
3338 expect ($ article ->heroImage ())->toContain ('https://images.unsplash.com/photo-1584824486509-112e4181ff6b ' );
39+ expect ($ article ->hero_image_author_name )->toBe ('Erik Mclean ' );
40+ expect ($ article ->hero_image_author_url )->toBe ('https://unsplash.com/@introspectivedsgn ' );
3441});
3542
36- test ('hero image url is not updated for published articles with no hero image ' , function () {
43+ test ('hero image url and author information is not updated for published articles with no hero image ' , function () {
3744 $ article = Article::factory ()->create ([
3845 'submitted_at ' => now (),
3946 'approved_at ' => now (),
4451 $ article ->refresh ();
4552
4653 expect ($ article ->hero_image_url )->toBe (null );
47- });
54+ expect ($ article ->hero_image_author_name )->toBe (null );
55+ expect ($ article ->hero_image_author_url )->toBe (null );
56+ })->only ();
You can’t perform that action at this time.
0 commit comments