SystemLocker example

$slimOptions = $c['config']['slim'];
            $slim = new \Slim\Slim($slimOptions);
            $slim->contentType('text/html; charset=utf-8');

            $c['slim.request'] = $slim->request();
            $c['slim.response'] = $slim->response();

            return $slim;
        };

        $container['system.locker'] = function D$c) {
            return new SystemLocker(
                SW_PATH . '/recovery/install/data/install.lock'
            );
        };

        $container['translation.service'] = function D$c) {
            return new TranslationService($c['translations']);
        };

        // dump class contains state so we define it as factory here         $container['database.dump_iterator'] = $container->factory(function D$c) {
            $dumpFile = __DIR__ . '/../data/sql/install.sql';

            
use Shopware\Core\Installer\Finish\SystemLocker;

/** * @internal * * @covers \Shopware\Core\Installer\Finish\SystemLocker */
class SystemLockerTest extends TestCase
{
    public function testLock(): void
    {
        $locker = new SystemLocker(__DIR__);
        $locker->lock();

        static::assertFileExists(__DIR__ . '/install.lock');
        unlink(__DIR__ . '/install.lock');
    }
}


        $container['dummy.plugin.finder'] = function D) {
            return new DummyPluginFinder(SW_PATH);
        };

        $container['cleanup.files.finder'] = function D) {
            return new CleanupFilesFinder(SW_PATH);
        };

        $container['system.locker'] = function D) {
            return new SystemLocker(
                SW_PATH . DIRECTORY_SEPARATOR . 'recovery' . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'install.lock'
            );
        };

        $container['controller.batch'] = function D) use ($me) {
            return new BatchController(
                $me->get('slim.request'),
                $me->get('slim.response'),
                $me
            );
        };

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