Skip to content

Commit

Permalink
[TASK] Adapt GravatarProviderTest for v13
Browse files Browse the repository at this point in the history
  • Loading branch information
bnf committed Oct 17, 2024
1 parent 0c1760f commit 0d0f0cf
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Tests/Functional/AvatarProvider/GravatarProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@

use T3G\AgencyPack\Blog\AvatarProvider\GravatarProvider;
use T3G\AgencyPack\Blog\Domain\Model\Author;
use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder;
use TYPO3\CMS\Core\Http\ServerRequest;
use TYPO3\CMS\Core\TypoScript\AST\Node\RootNode;
use TYPO3\CMS\Core\TypoScript\FrontendTypoScript;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

class GravatarProviderTest extends FunctionalTestCase
Expand All @@ -26,6 +31,13 @@ class GravatarProviderTest extends FunctionalTestCase

public function testGetAvatarUrlReturnsOriginalGravatarComUrl(): void
{
$frontendTypoScript = new FrontendTypoScript(new RootNode(), [], [], []);
$frontendTypoScript->setSetupArray([]);
$request = (new ServerRequest())
->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_FE)
->withAttribute('frontend.typoscript', $frontendTypoScript);
$this->get(ConfigurationManagerInterface::class)->setRequest($request);

$author = (new Author())->setEmail('name@host.tld');
$gravatarProvider = new GravatarProvider();
self::assertSame(
Expand All @@ -37,6 +49,12 @@ public function testGetAvatarUrlReturnsOriginalGravatarComUrl(): void
public function testGetAvatarUrlReturnsTypo3TempUrl(): void
{
$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['blog']['enableGravatarProxy'] = '1';
$frontendTypoScript = new FrontendTypoScript(new RootNode(), [], [], []);
$frontendTypoScript->setSetupArray([]);
$request = (new ServerRequest())
->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_FE)
->withAttribute('frontend.typoscript', $frontendTypoScript);
$this->get(ConfigurationManagerInterface::class)->setRequest($request);

$author = (new Author())->setEmail('name@host.tld');
$gravatarProvider = new GravatarProvider();
Expand Down

0 comments on commit 0d0f0cf

Please sign in to comment.