Skip to content

Commit

Permalink
Add available locales test
Browse files Browse the repository at this point in the history
  • Loading branch information
Prokyonn committed Apr 17, 2023
1 parent 71c88a0 commit a45593c
Showing 1 changed file with 15 additions and 4 deletions.
Expand Up @@ -15,6 +15,7 @@

use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\DimensionContentInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ShadowInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\TemplateInterface;
use Sulu\Bundle\ContentBundle\Content\Infrastructure\Sulu\Structure\ContentDocument;
Expand Down Expand Up @@ -745,9 +746,9 @@ public function testGetShadowBaseLanguageWithShadowEnabled(): void
$content->willImplement(ShadowInterface::class);
$content->getShadowLocale()->shouldBeCalled()->willReturn('de');

$structure = $this->createStructureBridge();
$structure = $this->createStructureBridge($content->reveal());

$this->assertNull($structure->getShadowBaseLanguage());
$this->assertSame('de', $structure->getShadowBaseLanguage());
}

public function testGetIsShadowWithShadowEnabled(): void
Expand All @@ -756,9 +757,9 @@ public function testGetIsShadowWithShadowEnabled(): void
$content->willImplement(ShadowInterface::class);
$content->getShadowLocale()->shouldBeCalled()->willReturn('de');

$structure = $this->createStructureBridge();
$structure = $this->createStructureBridge($content->reveal());

$this->assertFalse($structure->getIsShadow());
$this->assertTrue($structure->getIsShadow());
}

public function testGetContentLocales(): void
Expand All @@ -768,6 +769,16 @@ public function testGetContentLocales(): void
$this->assertSame([], $structure->getContentLocales());
}

public function testGetContentLocalesWithDimensionContentInterface(): void
{
$content = $this->prophesize(TemplateInterface::class);
$content->willImplement(DimensionContentInterface::class);
$content->getAvailableLocales()->shouldBeCalled()->willReturn(['de', 'en']);
$structure = $this->createStructureBridge($content->reveal());

$this->assertSame(['de', 'en'], $structure->getContentLocales());
}

public function testGetOriginalTemplate(): void
{
$structure = $this->createStructureBridge();
Expand Down

0 comments on commit a45593c

Please sign in to comment.