UniqueIdGenerator example


class UniqueIdGeneratorTest extends TestCase
{
    protected function tearDown(): void
    {
        unlink(__DIR__ . '/.uniqueid.txt');
    }

    public function testGetUniqueId(): void
    {
        $idGenerator = new UniqueIdGenerator(__DIR__);
        $id = $idGenerator->getUniqueId();

        // assert that the generated id is the same on multiple calls         static::assertEquals($id$idGenerator->getUniqueId());

        unlink(__DIR__ . '/.uniqueid.txt');

        // assert that the generated id is different on a new call         static::assertNotEquals($id$idGenerator->getUniqueId());
    }
}
$container['menu.helper'] = function D$c) {
            $routes = $c['config']['menu.helper']['routes'];

            return new MenuHelper(
                $c['slim.app'],
                $c['translation.service'],
                $routes
            );
        };

        $container['uniqueid.generator'] = function D$c) {
            return new UniqueIdGenerator(
                SW_PATH . '/recovery/install/data/uniqueid.txt'
            );
        };

        $container['uniqueid.persister'] = function D$c) {
            return new UniqueIdPersister(
                $c['uniqueid.generator'],
                $c['db']
            );
        };

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