Skip to content

Commit

Permalink
[Tests] Added mocking zip extenstion loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
ciastektk committed Jun 3, 2024
1 parent 4b5c8e3 commit b767015
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/lib/UI/Config/Provider/Module/DamWidgetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
use Ibexa\Contracts\Core\Repository\ContentTypeService;
use Ibexa\Contracts\Core\Repository\NameSchema\SchemaIdentifierExtractorInterface;
use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType;
use phpmock\functions\FixedValueFunction;
use phpmock\MockBuilder;
use phpmock\phpunit\PHPMock;
use PHPUnit\Framework\TestCase;

/**
Expand Down Expand Up @@ -50,6 +53,8 @@
*/
final class DamWidgetTest extends TestCase
{
use PHPMock;

private const IMAGE_FOO_CONTENT_TYPE_IDENTIFIER = 'content_type_foo';
private const IMAGE_BAR_CONTENT_TYPE_IDENTIFIER = 'content_type_bar';
private const IMAGE_FOO_NAME_SCHEMA = '<image_title|name>';
Expand Down Expand Up @@ -137,6 +142,7 @@ public function testGetConfig(
$this->mockRepositoryConfigurationProviderGetRepositoryConfig($repositoryConfig);
$this->mockContentTypeServiceLoadContentTypeByIdentifier($loadContentTypeValueMap);
$this->mockSchemaIdentifierExtractorExtract($extractSchemaIdentifiersValueMap);
$this->mockZipExtensionLoaded();

self::assertEquals(
$expectedConfiguration,
Expand Down Expand Up @@ -289,4 +295,18 @@ private function mockRepositoryConfigurationProviderGetCurrentRepositoryAlias(st
->method('getCurrentRepositoryAlias')
->willReturn($repositoryAlias);
}

private function mockZipExtensionLoaded(): void
{
$mockBuilder = new MockBuilder();
$mockBuilder
->setNamespace('\\Ibexa\\AdminUi\\UI\\Config\\Provider\\Module')
->setName('extension_loaded')
->setFunctionProvider(
new FixedValueFunction(true)
);

$mock = $mockBuilder->build();
$mock->enable();
}
}

0 comments on commit b767015

Please sign in to comment.