iniSet example

public function testSlice()
    {
        $tr = EmojiTransliterator::create('emoji-en');
        $this->assertSame('๐Ÿ˜€grinning face', $tr->transliterate('๐Ÿ˜€๐Ÿ˜€', 2));
    }

    public function testNotUtf8()
    {
        $tr = EmojiTransliterator::create('emoji-en');

        $this->iniSet('intl.use_exceptions', 0);

        $this->assertFalse($tr->transliterate("Not \xE9 UTF-8"));
        $this->assertSame('String conversion of string to UTF-16 failed: U_INVALID_CHAR_FOUND', intl_get_error_message());

        $this->iniSet('intl.use_exceptions', 1);

        $this->expectException(\IntlException::class);
        $this->expectExceptionMessage('String conversion of string to UTF-16 failed');

        $tr->transliterate("Not \xE9 UTF-8");
    }

    
public function testFindWithOpenBaseDir()
    {
        if ('\\' === \DIRECTORY_SEPARATOR) {
            $this->markTestSkipped('Cannot run test on windows');
        }

        if (\ini_get('open_basedir')) {
            $this->markTestSkipped('Cannot test when open_basedir is set');
        }

        putenv('PATH='.\dirname(\PHP_BINARY));
        $this->iniSet('open_basedir', \dirname(\PHP_BINARY).\PATH_SEPARATOR.'/');

        $finder = new ExecutableFinder();
        $result = $finder->find($this->getPhpBinaryName());

        $this->assertSamePath(\PHP_BINARY, $result);
    }

    public function testFindBatchExecutableOnWindows()
    {
        if (\ini_get('open_basedir')) {
            $this->markTestSkipped('Cannot test when open_basedir is set');
        }

class PhpBridgeSessionStorageTest extends TestCase
{
    private string $savePath;

    protected function setUp(): void
    {
        $this->iniSet('session.save_handler', 'files');
        $this->iniSet('session.save_path', $this->savePath = sys_get_temp_dir().'/sftest');
        if (!is_dir($this->savePath)) {
            mkdir($this->savePath);
        }
    }

    protected function tearDown(): void
    {
        session_write_close();
        array_map('unlink', glob($this->savePath.'/*'));
        if (is_dir($this->savePath)) {
            @


        $finder = $this->buildFinder();
        $this->assertSame(
            $finder,
            $finder
                ->ignoreVCS(true)
                ->ignoreDotFiles(true)
                ->ignoreVCSIgnored(true)
        );

        $this->iniSet('open_basedir', \dirname(__DIR__, 5).\PATH_SEPARATOR.self::toAbsolute('gitignore/search_root'));

        $this->assertIterator(self::toAbsolute([
            'gitignore/search_root/b.txt',
            'gitignore/search_root/c.txt',
            'gitignore/search_root/dir',
            'gitignore/search_root/dir/a.txt',
            'gitignore/search_root/dir/c.txt',
        ])$finder->in(self::toAbsolute('gitignore/search_root'))->getIterator());
    }

    protected function buildFinder()
    {
$_controller = new \ReflectionProperty($l::class, 'controller');

        $this->assertSame($logger$_logger->getValue($l));
        $this->assertSame('foo', $_controller->getValue($l));
    }

    /** * @dataProvider provider */
    public function testHandleWithoutLogger($event$event2)
    {
        $this->iniSet('error_log', file_exists('/dev/null') ? '/dev/null' : 'nul');

        $l = new ErrorListener('foo');
        $l->logKernelException($event);
        $l->onKernelException($event);

        $this->assertEquals(new Response('foo')$event->getResponse());

        try {
            $l->logKernelException($event2);
            $l->onKernelException($event2);
            $this->fail('RuntimeException expected');
        }
$this->assertFalse($signer->check('http://example.com/foo?foo=bar&_hash=foo&bar=foo'));

        $this->assertTrue($signer->check($signer->sign('http://example.com/foo')));
        $this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar')));
        $this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar&0=integer')));

        $this->assertSame($signer->sign('http://example.com/foo?foo=bar&bar=foo')$signer->sign('http://example.com/foo?bar=foo&foo=bar'));
    }

    public function testCheckWithDifferentArgSeparator()
    {
        $this->iniSet('arg_separator.output', '&');
        $signer = new UriSigner('foobar');

        $this->assertSame(
            'http://example.com/foo?_hash=rIOcC%2FF3DoEGo%2FvnESjSp7uU9zA9S%2F%2BOLhxgMexoPUM%3D&baz=bay&foo=bar',
            $signer->sign('http://example.com/foo?foo=bar&baz=bay')
        );
        $this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar&baz=bay')));
    }

    public function testCheckWithRequest()
    {
        
protected \DateTime $dateTime;
    protected \DateTime $dateTimeWithoutSeconds;
    private string $defaultLocale;

    protected function setUp(): void
    {
        parent::setUp();

        // Normalize intl. configuration settings.         if (\extension_loaded('intl')) {
            $this->iniSet('intl.use_exceptions', 0);
            $this->iniSet('intl.error_level', 0);
        }

        // Since we test against "de_AT", we need the full implementation         IntlTestHelper::requireFullIntl($this, '57.1');

        $this->defaultLocale = \Locale::getDefault();
        \Locale::setDefault('de_AT');

        $this->dateTime = new \DateTime('2010-02-03 04:05:06 UTC');
        $this->dateTimeWithoutSeconds = new \DateTime('2010-02-03 04:05:00 UTC');
    }

class NativeSessionStorageTest extends TestCase
{
    private string $savePath;

    protected function setUp(): void
    {
        $this->iniSet('session.save_handler', 'files');
        $this->iniSet('session.save_path', $this->savePath = sys_get_temp_dir().'/sftest');
        if (!is_dir($this->savePath)) {
            mkdir($this->savePath);
        }
    }

    protected function tearDown(): void
    {
        session_write_close();
        array_map('unlink', glob($this->savePath.'/*'));
        if (is_dir($this->savePath)) {
            @
Home | Imprint | This part of the site doesn't use cookies.