Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php /** * This file is part of the reliforp/reli-prof package. * * (c) sji <sji@sj-i..

Decoded Output download

<?php

/**
 * This file is part of the reliforp/reli-prof package.
 *
 * (c) sji <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

namespace Reli\Inspector\Settings\DaemonSettings;

use Mockery;
use Reli\BaseTestCase;
use Symfony\Component\Console\Input\InputInterface;

class DaemonSettingsFromConsoleInputTest extends BaseTestCase
{
    public function testFromConsoleInput(): void
    {
        $input = Mockery::mock(InputInterface::class);
        $input->expects()->getOption('threads')->andReturns(4);
        $input->expects()->getOption('target-regex')->andReturns('regex');
        $settings = (new DaemonSettingsFromConsoleInput())->createSettings($input);

        $this->assertSame('{regex}', $settings->target_regex);
        $this->assertSame(4, $settings->threads);
    }

    public function testFromConsoleInputTargetRegexNotSpecified(): void
    {
        $input = Mockery::mock(InputInterface::class);
        $input->allows()->getOption('threads')->andReturns(null);
        $input->expects()->getOption('target-regex')->andReturns(null);
        $this->expectException(DaemonSettingsException::class);
        (new DaemonSettingsFromConsoleInput())->createSettings($input);
    }

    public function testFromConsoleInputThreadsNotInteger(): void
    {
        $input = Mockery::mock(InputInterface::class);
        $input->expects()->getOption('threads')->andReturns('abc');
        $input->allows()->getOption('target-regex')->andReturns(null);
        $this->expectException(DaemonSettingsException::class);
        (new DaemonSettingsFromConsoleInput())->createSettings($input);
    }

    public function testFromConsoleInputTargetRegexNotString(): void
    {
        $input = Mockery::mock(InputInterface::class);
        $input->allows()->getOption('threads')->andReturns(null);
        $input->expects()->getOption('target-regex')->andReturns(1);
        $this->expectException(DaemonSettingsException::class);
        (new DaemonSettingsFromConsoleInput())->createSettings($input);
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

/**
 * This file is part of the reliforp/reli-prof package.
 *
 * (c) sji <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

namespace Reli\Inspector\Settings\DaemonSettings;

use Mockery;
use Reli\BaseTestCase;
use Symfony\Component\Console\Input\InputInterface;

class DaemonSettingsFromConsoleInputTest extends BaseTestCase
{
    public function testFromConsoleInput(): void
    {
        $input = Mockery::mock(InputInterface::class);
        $input->expects()->getOption('threads')->andReturns(4);
        $input->expects()->getOption('target-regex')->andReturns('regex');
        $settings = (new DaemonSettingsFromConsoleInput())->createSettings($input);

        $this->assertSame('{regex}', $settings->target_regex);
        $this->assertSame(4, $settings->threads);
    }

    public function testFromConsoleInputTargetRegexNotSpecified(): void
    {
        $input = Mockery::mock(InputInterface::class);
        $input->allows()->getOption('threads')->andReturns(null);
        $input->expects()->getOption('target-regex')->andReturns(null);
        $this->expectException(DaemonSettingsException::class);
        (new DaemonSettingsFromConsoleInput())->createSettings($input);
    }

    public function testFromConsoleInputThreadsNotInteger(): void
    {
        $input = Mockery::mock(InputInterface::class);
        $input->expects()->getOption('threads')->andReturns('abc');
        $input->allows()->getOption('target-regex')->andReturns(null);
        $this->expectException(DaemonSettingsException::class);
        (new DaemonSettingsFromConsoleInput())->createSettings($input);
    }

    public function testFromConsoleInputTargetRegexNotString(): void
    {
        $input = Mockery::mock(InputInterface::class);
        $input->allows()->getOption('threads')->andReturns(null);
        $input->expects()->getOption('target-regex')->andReturns(1);
        $this->expectException(DaemonSettingsException::class);
        (new DaemonSettingsFromConsoleInput())->createSettings($input);
    }
}

Function Calls

None

Variables

None

Stats

MD5 1837d191e50c832d7f654add5bded44f
Eval Count 0
Decode Time 94 ms