1
0
Fork 0
mirror of https://github.com/archtechx/laravel-seo.git synced 2025-12-12 01:44:03 +00:00

Fix flipp alias logic

This commit is contained in:
Samuel Štancl 2021-05-24 18:41:03 +02:00
parent 8b6e049830
commit 56fc6f4b49
2 changed files with 10 additions and 2 deletions

View file

@ -153,6 +153,8 @@ class SEOManager
$signature = hash_hmac('sha256', $template . $query, config('services.flipp.key'));
$template = $this->meta("flipp.templates.$template");
return $this->set('image', "https://s.useflipp.com/{$template}.png?s={$signature}&v={$query}");
}

View file

@ -10,10 +10,16 @@ test('flipp templates can be set', function () {
->toHaveKey('blog', 'abcdefg');
});
test('flipp makes a request to the template not the alias', function () {
seo()->flipp('blog', 'abcdefg');
expect(seo()->flipp('blog'))
->toContain('s.useflipp.com/abcdefg');
});
test('flipp templates can be given data', function () {
seo()->flipp('blog', 'abcdefg');
expect(seo()->flipp('blog', ['title' => 'abc', 'excerpt' => 'def']))
->toContain('s.useflipp.com/blog')
->toContain('s.useflipp.com/abcdefg')
->toContain(base64_encode(json_encode(['title' => 'abc', 'excerpt' => 'def'])));
});
@ -30,7 +36,7 @@ test("flipp templates use default data when they're not passed any data explicit
seo()->title('foo')->description('bar');
expect(seo()->flipp('blog'))
->toContain('s.useflipp.com/blog')
->toContain('s.useflipp.com/abcdefg')
->toContain(base64_encode(json_encode(['title' => 'foo', 'description' => 'bar'])));
});