Skip to content

Commit

Permalink
rename getImage() to be getSocialImage() since that's what it is look…
Browse files Browse the repository at this point in the history
…ing for
  • Loading branch information
chrispelzer committed Oct 24, 2023
1 parent b0504a4 commit e67339a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/ArticleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function show(Request $request): View|Redirector|RedirectResponse
$request->data['base']['hero'][]['relative_url'] = $article['article']['data']['hero_image']['url'];
}

$image = $this->article->getImage($article['article']['data']);
$image = $this->article->getSocialImage($article['article']['data']);

$request->data['base']['meta']['image'] = $image['url'];
$request->data['base']['meta']['image_alt'] = $image['alt_text'];
Expand Down
2 changes: 1 addition & 1 deletion app/Repositories/ArticleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function find($id, $application_ids, $preview = null)
/**
* {@inheritdoc}
*/
public function getImage($article)
public function getSocialImage($article)
{
if (!empty($article['social_image'])) {
return [
Expand Down
2 changes: 1 addition & 1 deletion contracts/Repositories/ArticleRepositoryContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function find($id, $application_ids, $preview);
* @param array $article
* @return array
*/
public function getImage($article);
public function getSocialImage($article);

/**
* Set the paging.
Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/Repositories/ArticleRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function article_with_no_images_should_return_null(): void
'body' => null,
]);

$imageUrl = app(ArticleRepository::class)->getImage($article);
$imageUrl = app(ArticleRepository::class)->getSocialImage($article);

$this->assertNull($imageUrl['url']);
$this->assertNull($imageUrl['alt_text']);
Expand All @@ -161,7 +161,7 @@ public function article_with_hero_should_return_hero_url(): void
'social_image' => null,
]);

$imageUrl = app(ArticleRepository::class)->getImage($article['data']);
$imageUrl = app(ArticleRepository::class)->getSocialImage($article['data']);

$this->assertEquals($article['data']['hero_image']['url'], $imageUrl['url']);
$this->assertEquals($article['data']['hero_image']['alt_text'], $imageUrl['alt_text']);
Expand All @@ -179,7 +179,7 @@ public function article_with_body_image_should_return_url(): void
'body' => '<img src="'.$url.'" alt="'.$alt.'">',
]);

$image = app(ArticleRepository::class)->getImage($article['data']);
$image = app(ArticleRepository::class)->getSocialImage($article['data']);

$this->assertEquals($url, $image['url']);
$this->assertEquals($alt, $image['alt_text']);
Expand All @@ -190,7 +190,7 @@ public function article_with_social_image_should_return_url(): void
{
$article = app(Article::class)->create(1, true);

$imageUrl = app(ArticleRepository::class)->getImage($article['data']);
$imageUrl = app(ArticleRepository::class)->getSocialImage($article['data']);

$this->assertEquals($article['data']['social_image']['url'], $imageUrl['url']);
$this->assertEquals($article['data']['social_image']['alt_text'], $imageUrl['alt_text']);
Expand Down

0 comments on commit e67339a

Please sign in to comment.