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 Symfony package. * * (c) Fabien Potencier <fabien@..

Decoded Output download

<?php

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

namespace Symfony\Component\Console\Tests\Completion\Output;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Completion\CompletionSuggestions;
use Symfony\Component\Console\Completion\Output\CompletionOutputInterface;
use Symfony\Component\Console\Completion\Suggestion;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\StreamOutput;

abstract class CompletionOutputTestCase extends TestCase
{
    abstract public function getCompletionOutput(): CompletionOutputInterface;

    abstract public function getExpectedOptionsOutput(): string;

    abstract public function getExpectedValuesOutput(): string;

    public function testOptionsOutput()
    {
        $options = [
            new InputOption('option1', 'o', InputOption::VALUE_NONE, 'First Option'),
            new InputOption('negatable', null, InputOption::VALUE_NEGATABLE, 'Can be negative'),
        ];
        $suggestions = new CompletionSuggestions();
        $suggestions->suggestOptions($options);
        $stream = fopen('php://memory', 'rw+');
        $this->getCompletionOutput()->write($suggestions, new StreamOutput($stream));
        fseek($stream, 0);
        $this->assertEquals($this->getExpectedOptionsOutput(), stream_get_contents($stream));
    }

    public function testValuesOutput()
    {
        $suggestions = new CompletionSuggestions();
        $suggestions->suggestValues([
            new Suggestion('Green', 'Beans are green'),
            new Suggestion('Red', 'Rose are red'),
            new Suggestion('Yellow', 'Canaries are yellow'),
        ]);
        $stream = fopen('php://memory', 'rw+');
        $this->getCompletionOutput()->write($suggestions, new StreamOutput($stream));
        fseek($stream, 0);
        $this->assertEquals($this->getExpectedValuesOutput(), stream_get_contents($stream));
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

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

namespace Symfony\Component\Console\Tests\Completion\Output;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Completion\CompletionSuggestions;
use Symfony\Component\Console\Completion\Output\CompletionOutputInterface;
use Symfony\Component\Console\Completion\Suggestion;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\StreamOutput;

abstract class CompletionOutputTestCase extends TestCase
{
    abstract public function getCompletionOutput(): CompletionOutputInterface;

    abstract public function getExpectedOptionsOutput(): string;

    abstract public function getExpectedValuesOutput(): string;

    public function testOptionsOutput()
    {
        $options = [
            new InputOption('option1', 'o', InputOption::VALUE_NONE, 'First Option'),
            new InputOption('negatable', null, InputOption::VALUE_NEGATABLE, 'Can be negative'),
        ];
        $suggestions = new CompletionSuggestions();
        $suggestions->suggestOptions($options);
        $stream = fopen('php://memory', 'rw+');
        $this->getCompletionOutput()->write($suggestions, new StreamOutput($stream));
        fseek($stream, 0);
        $this->assertEquals($this->getExpectedOptionsOutput(), stream_get_contents($stream));
    }

    public function testValuesOutput()
    {
        $suggestions = new CompletionSuggestions();
        $suggestions->suggestValues([
            new Suggestion('Green', 'Beans are green'),
            new Suggestion('Red', 'Rose are red'),
            new Suggestion('Yellow', 'Canaries are yellow'),
        ]);
        $stream = fopen('php://memory', 'rw+');
        $this->getCompletionOutput()->write($suggestions, new StreamOutput($stream));
        fseek($stream, 0);
        $this->assertEquals($this->getExpectedValuesOutput(), stream_get_contents($stream));
    }
}

Function Calls

None

Variables

None

Stats

MD5 e29b165b35801d48062946b5695dd6a2
Eval Count 0
Decode Time 96 ms