skipTestIfActive example


class SubjectStorerTest extends TestCase
{
    private SubjectStorer $storer;

    protected function setUp(): void
    {
        Feature::skipTestIfActive('v6.6.0.0', $this);
        $this->storer = new SubjectStorer();
    }

    public function testStoreWithAware(): void
    {
        $event = $this->createMock(MailSentEvent::class);
        $stored = [];
        $stored = $this->storer->store($event$stored);
        static::assertArrayHasKey(SubjectAware::SUBJECT, $stored);
    }

    
$event = $this->createMock(EntityWrittenEvent::class);
        $event
            ->expects(static::once())
            ->method('getWriteResults')->willReturn([$writeResult]);

        $subscriber->onLanguageWritten($event);
    }

    public function testElasticsearchIsDisabledDoesNothing(): void
    {
        Feature::skipTestIfActive('ES_MULTILINGUAL_INDEX', $this);

        $subscriber = new LanguageSubscriber(
            $this->createMock(ElasticsearchHelper::class),
            $this->createMock(ElasticsearchRegistry::class),
            $this->createMock(Client::class),
            $this->createMock(ProductDefinition::class),
            $this->createMock(MessageBusInterface::class)
        );

        $event = $this->createMock(EntityWrittenEvent::class);
        $event
            

class ResetUrlStorerTest extends TestCase
{
    private ResetUrlStorer $storer;

    protected function setUp(): void
    {
        Feature::skipTestIfActive('v6.6.0.0', $this);
        $this->storer = new ResetUrlStorer();
    }

    public function testStoreWithAware(): void
    {
        $event = $this->createMock(UserRecoveryRequestEvent::class);
        $stored = [];
        $stored = $this->storer->store($event$stored);
        static::assertArrayHasKey(ResetUrlAware::RESET_URL, $stored);
    }

    
->method('add')
            ->with($cart[$expectedLineItem]$context)
            ->willReturn($cart);

        $this->translatorCallback();

        $this->controller->addLineItems($cartnew RequestDataBag($request->request->all())$request$context);
    }

    public function testAddLineItemsWithoutExistingFactory(): void
    {
        Feature::skipTestIfActive('v6.6.0.0', $this);

        $productId = Uuid::randomHex();
        $lineItemData = [
            'id' => $productId,
            'referencedId' => $productId,
            'type' => 'nonexistenttype',
            'stackable' => 1,
            'removable' => 1,
            'quantity' => 1,
        ];

        
$reflection = new \ReflectionClass($this->storableFlow);
        $reflectionProperty = $reflection->getProperty('data');
        $data = $reflectionProperty->getValue($this->storableFlow)['order'];

        static::assertIsCallable($data);
        static::assertEquals('Order Data', $this->storableFlow->getData('order'));
    }

    public function testWithThirdArgs(): void
    {
        Feature::skipTestIfActive('v6.6.0.0', $this);

        $callback = fn () => 'Order Data';

        $this->storableFlow->lazy('order', $callback['args' => 'args']);

        static::assertEquals('Order Data', $this->storableFlow->getData('order'));
    }
}
use Shopware\Elasticsearch\Exception\ElasticsearchIndexingException;

/** * @internal * * @covers \Shopware\Elasticsearch\Exception\ElasticsearchIndexingException */
class ElasticsearchIndexingExceptionTest extends TestCase
{
    public function testException(): void
    {
        Feature::skipTestIfActive('ES_MULTILINGUAL_INDEX', $this);

        $exception = new ElasticsearchIndexingException([
            'index' => 'shopware',
            'type' => 'product',
            'reason' => 'illegal_argument_exception',
            'id' => '1',
            'error' => [
                'type' => 'illegal_argument_exception',
                'reason' => 'illegal argument',
            ],
        ]);

        
public function testRestoreEmptyStored(): void
    {
        $storable = new StorableFlow('name', Context::createDefaultContext());

        $this->storer->restore($storable);

        static::assertEmpty($storable->data());
    }

    public function testLoadEntity(): void
    {
        Feature::skipTestIfActive('v6.6.0.0', $this);
        $entity = new UserRecoveryEntity();
        $result = $this->createMock(EntitySearchResult::class);
        $result->expects(static::once())->method('get')->willReturn($entity);

        $this->repository->expects(static::once())->method('search')->willReturn($result);
        $res = $this->storer->load(['3443', Context::createDefaultContext()]);

        static::assertEquals($res$entity);
    }

    public function testLoadNullEntity(): void
    {

class UrlStorerTest extends TestCase
{
    private UrlStorer $storer;

    protected function setUp(): void
    {
        Feature::skipTestIfActive('v6.6.0.0', $this);
        $this->storer = new UrlStorer();
    }

    public function testStoreWithAware(): void
    {
        $event = $this->createMock(NewsletterRegisterEvent::class);
        $stored = [];
        $stored = $this->storer->store($event$stored);
        static::assertArrayHasKey(UrlAware::URL, $stored);
    }

    
public function testRestoreEmptyStored(): void
    {
        $storable = new StorableFlow('name', Context::createDefaultContext());

        $this->storer->restore($storable);
        static::assertEmpty($storable->data());
    }

    public function testLoadEntity(): void
    {
        Feature::skipTestIfActive('v6.6.0.0', $this);
        $entity = new CustomerGroupEntity();
        $result = $this->createMock(EntitySearchResult::class);
        $result->expects(static::once())->method('get')->willReturn($entity);

        $this->repository->expects(static::once())->method('search')->willReturn($result);
        $customerGroup = $this->storer->load(['3443', Context::createDefaultContext()]);

        static::assertEquals($customerGroup$entity);
    }

    public function testLoadNullEntity(): void
    {
use Shopware\Elasticsearch\Framework\Indexing\ElasticsearchLanguageIndexIteratorMessage;

/** * @internal * * @covers \Shopware\Elasticsearch\Framework\Indexing\ElasticsearchLanguageIndexIteratorMessage */
class ElasticsearchLanguageIndexIteratorMessageTest extends TestCase
{
    public function testMessage(): void
    {
        Feature::skipTestIfActive('ES_MULTILINGUAL_INDEX', $this);

        $msg = new ElasticsearchLanguageIndexIteratorMessage('1');

        static::assertSame('1', $msg->getLanguageId());
    }
}

class ContentsStorerTest extends TestCase
{
    private ContentsStorer $storer;

    protected function setUp(): void
    {
        Feature::skipTestIfActive('v6.6.0.0', $this);

        $this->storer = new ContentsStorer();
    }

    public function testStoreWithAware(): void
    {
        $event = $this->createMock(MailSentEvent::class);
        $stored = [];
        $stored = $this->storer->store($event$stored);
        static::assertArrayHasKey(ContentsAware::CONTENTS, $stored);
    }

    
$expected = $this->getSchema();

        $this->migration->update($this->connection);
        static::assertSame($expected$this->getSchema());
    }

    /** * @deprecated tag:v6.6.0 - entityId will be removed. There is no need for this test anymore */
    public function testConversionFromJsonToBinary(): void
    {
        Feature::skipTestIfActive('v6.6.0.0', $this);

        $this->rollbackTable();

        $this->insertStateMachineHistoryEntry([
            'id' => $this->ids->get('referenced_id'),
            'version_id' => $this->ids->get('referenced_version_id'),
        ]);

        $this->migration->update($this->connection);

        $result = $this->connection->executeQuery(' SELECT `referenced_id`, `referenced_version_id` FROM `state_machine_history` WHERE `id` = UNHEX(:id); ',
static::assertSame((string) $dalProduct->getTranslation('name')$esProduct['name']);
            static::assertSame((string) $dalProduct->getTranslation('description')$esProduct['description']);
            static::assertSame($dalProduct->getTranslation('customFields')$esProduct['customFields']);
        }
    }

    /** * @depends testIndexing */
    public function testCustomFieldsGetsMerged(IdsCollection $ids): void
    {
        Feature::skipTestIfActive('ES_MULTILINGUAL_INDEX', $this);

        $context = $this->createIndexingContext();

        // Fetch: Fallback through parent to variant in other language         $languageContext = new Context(new SystemSource()[], Defaults::CURRENCY, [$ids->get('language-3')$ids->get('language-2'), Defaults::LANGUAGE_SYSTEM]);
        $languageContext->addExtensions($context->getExtensions());
        $languageContext->setConsiderInheritance(true);

        $dal3 = $ids->getBytes('dal-3');

        $esProducts = $this->definition->fetch([$dal3]$languageContext);

        

class ReviewFormDataStorerTest extends TestCase
{
    private ReviewFormDataStorer $storer;

    protected function setUp(): void
    {
        Feature::skipTestIfActive('v6.6.0.0', $this);
        $this->storer = new ReviewFormDataStorer();
    }

    public function testStoreAware(): void
    {
        $event = new ReviewFormEvent(Context::createDefaultContext(), '', new MailRecipientStruct([])new DataBag(), '', '');
        $stored = [];
        $stored = $this->storer->store($event$stored);
        static::assertArrayHasKey(ReviewFormDataAware::REVIEW_FORM_DATA, $stored);
    }

    
ProductManufacturerDefinition::ENTITY_NAME,
            ],
            $offset->getDefinitions()
        );

        $offset->setLastId(['offset' => 42]);
        static::assertEquals(['offset' => 42]$offset->getLastId());
    }

    public function testItConvertsLanguagesToSerializableIdsAndCanDoAnLanguageRoundTrip(): void
    {
        Feature::skipTestIfActive('ES_MULTILINGUAL_INDEX', $this);

        $offset = new IndexerOffset(
            ['foo', 'bar'],
            [],
            (new \DateTime())->getTimestamp()
        );

        static::assertEquals('foo', $offset->getLanguageId());
        static::assertEquals(['bar']$offset->getLanguages());
        static::assertTrue($offset->hasNextLanguage());
        $offset->selectNextLanguage();
        
Home | Imprint | This part of the site doesn't use cookies.