ini_restore example

->method('getTotalMigrationCount')
            ->willReturn(5);

        $this->migrationCollection->expects(static::once())
            ->method('getExecutableDestructiveMigrations')
            ->willReturn(['migration']);

        \ini_set('max_execution_time', '10');

        $result = $this->databaseMigrator->migrate(0, $this->connection);

        \ini_restore('max_execution_time');

        static::assertSame([
            'offset' => 1,
            'total' => 10,
            'isFinished' => false,
        ]$result);
    }

    public function testUnfinishedMigration(): void
    {
        $this->setupAdapter->expects(static::never())
            
// Clear entitymanager to prevent weird 'model shop not persisted' errors.         Shopware()->Models()->clear();
    }

    /** * Performs operation returned by getSetUpOperation(). */
    protected function tearDown(): void
    {
        set_time_limit(0);
        ini_restore('memory_limit');
    }

    /** * Allows to set a Shopware config * * @param bool|float|int|string|null $value */
    protected function setConfig(string $name$value): void
    {
        Shopware()->Container()->get('config_writer')->save($name$value);
        Shopware()->Container()->get(Zend_Cache_Core::class)->clean();
        

    /** * @dataProvider configProvider */
    public function testGet(string $key, string|false $configValue, string $expectedValue): void
    {
        \ini_set($key(string) $configValue);

        $reader = new IniConfigReader();
        static::assertSame($expectedValue$reader->get($key));

        \ini_restore($key);
    }

    public static function configProvider(): \Generator
    {
        yield 'max_execution_time' => [
            'max_execution_time',
            '30',
            '30',
        ];

        yield 'memory_limit' => [
            
Home | Imprint | This part of the site doesn't use cookies.