IncrementArrayStorage example

use IntegrationTestBehaviour;

    private IncrementSqlStorage $sqlStorage;

    private IncrementArrayStorage $arrayStorage;

    private CommandTester $tester;

    protected function setUp(): void
    {
        $this->sqlStorage = $this->getContainer()->get(IncrementSqlStorage::class);
        $this->arrayStorage = new IncrementArrayStorage([]);

        $command = new MigrateIncrementStorageCommand(
            new IncrementStorageRegistry(new \ArrayObject(
                [
                    'SQL' => $this->sqlStorage,
                    'Array' => $this->arrayStorage,
                ]
            ), 'SQL')
        );

        $this->tester = new CommandTester($command);
    }
static::assertInstanceOf(IncrementSqlStorage::class$this->registry->getStorage());
    }

    public function testGetUnknownStorageThrows(): void
    {
        static::expectException(IncrementStorageNotFoundException::class);
        $this->registry->getStorage('foo');
    }

    public function testMigrateToSqlStorage(): void
    {
        $arrayStorage = new IncrementArrayStorage([
            Uuid::randomHex() => 10,
            Uuid::randomHex() => 4,
        ]);
        $sqlStorage = $this->getContainer()->get(IncrementSqlStorage::class);

        $registry = new IncrementStorageRegistry(
            new \ArrayObject(
                [
                    'SQL' => $sqlStorage,
                    'Array' => $arrayStorage,
                ],
            ),
Home | Imprint | This part of the site doesn't use cookies.