<commit_before><?php

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

namespace Symfony\Component\Process\Tests;

use Symfony\Component\Process\Process;

/**
 * @author <NAME> <<EMAIL>>
 */
class ProcessTest extends \PHPUnit_Framework_TestCase
{
    /**
     * tests getter/setter
     *
     * @dataProvider methodProvider
     */
    public function testDefaultGetterSetter($fn)
    {
        $p = new Process('php');

        $setter = 'set'.$fn;
        $getter = 'get'.$fn;

        $this->assertNull($p->$setter(array('foo')));

        $this->assertSame(array('foo'), $p->$getter(array('foo')));
    }

    /**
     * tests results from sub processes
     *
     * @dataProvider responsesCodeProvider
     */
    public function testProcessResponses($expected, $getter, $code)
    {
        $p = new Process(sprintf('php -r %s', escapeshellarg($code)));
        $p->run();

        $this->assertSame($expected, $p->$getter());
    }

    /**
     * tests results from sub processes
     *
     * @dataProvider pipesCodeProvider
     */
    public function testProcessPipes($expected, $code)
    {
        if (strpos(PHP_OS, "WIN") === 0 && version_compare(phpversion(), "5.3.9", "<")) {
            $this->markTestSkipped('Test hangs on Windows & PHP due to https://bugs.php.net/bug.php?id=60120 fixed in http://svn.php.net/viewvc?view=revision&revision=318366');
        }

        $p = new Process(sprintf('php -r %s', escapeshellarg($code)));
        $p->setStdin($expected);
        $p->run();

        $this->assertSame($expected, $p->getOutput());
        $this->assertSame($expected, $p->getErrorOutput());
        $this->assertSame(0, $p->getExitCode());
    }

    public function testExitCodeText()
    {
        $process = new Process('');<commit_msg>[Process] Skip test that is still getting stuck on windows<commit_after><?php

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

namespace Symfony\Component\Process\Tests;

use Symfony\Component\Process\Process;

/**
 * @author <NAME> <<EMAIL>>
 */
class ProcessTest extends \PHPUnit_Framework_TestCase
{
    /**
     * tests getter/setter
     *
     * @dataProvider methodProvider
     */
    public function testDefaultGetterSetter($fn)
    {
        $p = new Process('php');

        $setter = 'set'.$fn;
        $getter = 'get'.$fn;

        $this->assertNull($p->$setter(array('foo')));

        $this->assertSame(array('foo'), $p->$getter(array('foo')));
    }

    /**
     * tests results from sub processes
     *
     * @dataProvider responsesCodeProvider
     */
    public function testProcessResponses($expected, $getter, $code)
    {
        $p = new Process(sprintf('php -r %s', escapeshellarg($code)));
        $p->run();

        $this->assertSame($expected, $p->$getter());
    }

    /**
     * tests results from sub processes
     *
     * @dataProvider pipesCodeProvider
     */
    public function testProcessPipes($expected, $code)
    {
        if (strpos(PHP_OS, "WIN") === 0) {
            $this->markTestSkipped('Test hangs on Windows & PHP due to https://bugs.php.net/bug.php?id=60120 and https://bugs.php.net/bug.php?id=51800');
        }

        $p = new Process(sprintf('php -r %s', escapeshellarg($code)));
        $p->setStdin($expected);
        $p->run();

        $this->assertSame($expected, $p->getOutput());
        $this->assertSame($expected, $p->getErrorOutput());
        $this->assertSame(0, $p->getExitCode());
    }

    public function testExitCodeText()
    {
        $process = new Process('');
{'fraction_non_alphanumeric': 0.1641907740422205, 'fraction_numerical': 0.007297367735209799, 'mean_word_length': 2.7334630350194553, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 47, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5355982', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1179, 'n_words': 261}