ShopNameStorer example


class ShopNameStorerTest extends TestCase
{
    private ShopNameStorer $storer;

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

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

    public function testStoreWithNotAware(): void
    {
class ScalarFlowStorerTest extends TestCase
{
    public function testCallOldFirst(): void
    {
        $event = new BcEvent();

        $stored = [];
        $stored = (new ScalarValuesStorer())->store($event$stored);

        // check old value is stored correctly         if (!Feature::isActive('v6.6.0.0')) {
            $stored = (new ShopNameStorer())->store($event$stored);
            static::assertArrayHasKey('shopName', $stored);
            static::assertEquals('my-shop-name', $stored['shopName']);
        }

        // check new value are stored correctly         static::assertArrayHasKey(ScalarValuesAware::STORE_VALUES, $stored);
        static::assertArrayHasKey('shopName', $stored[ScalarValuesAware::STORE_VALUES]);
        static::assertArrayHasKey('whatWhenIChooseAnotherName', $stored[ScalarValuesAware::STORE_VALUES]);
        static::assertEquals('my-shop-name', $stored[ScalarValuesAware::STORE_VALUES]['shopName']);
        static::assertEquals('my-shop-name', $stored[ScalarValuesAware::STORE_VALUES]['whatWhenIChooseAnotherName']);

        
Home | Imprint | This part of the site doesn't use cookies.