<commit_before><?php
/**
 * This file is part of the Netrc package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * Date: 3/21/14
 */

namespace Fduch\Netrc;

use PHPUnit_Framework_TestCase;

class ParserTest extends \PHPUnit_Framework_TestCase
{
    protected $parser;

    protected function setUp()
    {
        $this->parser = new Parser();
    }

    /**
     * @test
     */
    public function testCorrectNetrcParsedSuccessfully()
    {
        $netrc = <<<EOF
machine machine.one login john password <PASSWORD>
machine machine.two login steve password <PASSWORD>
EOF;
        $this->assertEquals(
            $this->parser->parse($netrc),
            array(
                "machine.one" => array('login' => 'john', 'password' => '<PASSWORD>'),
                "machine.two" => array('login' => 'steve', 'password' => '<PASSWORD>'),
            )
        );
    }

    /**
     * @expectedException Fduch\Netrc\Exception\ParseException
     * @test
     */
    public function testIncorrectDefaultThrowsException()
    {
        $netrc = <<<EOF
default machine.one login john password <PASSWORD>
EOF;
        $this->parser->parse($netrc);
    }

    /**
     * @expectedException Fduch\Netrc\Exception\ParseException
     * @test
     */
    public function testIncorrectKeyThrowsException()
    {
        $netrc = <<<EOF
machine machine.one logOn john password <PASSWORD>
EOF;
        $this->parser->parse($netrc);
    }

    /**
     * @expectedException Fduch\Netrc\Exception\ParseException
     * @test
     */
    public function testEmptyMachineNameThrowsException()
    {
        $netrc = <<<EOF
machine
EOF;
        $this->parser->parse($netrc);
    }

    /**
     * @expectedException Fduch\Netrc\Exception\ParseException
     * @test
     */
    public function testUnsetValueForValidKeyThrowsException()
    {
        $netrc = <<<EOF
machine machine.one login
EOF;
        $this->parser->parse($netrc);
    }

    /**
     * @expectedException Fduch\Netrc\Exception\ParseException
     * @test
     */
    public function testAttemtToSetInfoForUnknownMachineThrowsException()
    {
        $netrc = <<<EOF
login john
EOF;
        $this->parser->parse($netrc);
    }
}
 <commit_msg>ommit unneccesary 'test' prefixes in test methods<commit_after><?php
/**
 * This file is part of the Netrc package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * Date: 3/21/14
 */

namespace Fduch\Netrc;

use PHPUnit_Framework_TestCase;

class ParserTest extends \PHPUnit_Framework_TestCase
{
    protected $parser;

    protected function setUp()
    {
        $this->parser = new Parser();
    }

    /**
     * @test
     */
    public function correctNetrcParsedSuccessfully()
    {
        $netrc = <<<EOF
machine machine.one login john password <PASSWORD>
machine machine.two login steve password <PASSWORD>
EOF;
        $this->assertEquals(
            $this->parser->parse($netrc),
            array(
                "machine.one" => array('login' => 'john', 'password' => '<PASSWORD>'),
                "machine.two" => array('login' => 'steve', 'password' => '<PASSWORD>'),
            )
        );
    }

    /**
     * @expectedException Fduch\Netrc\Exception\ParseException
     * @test
     */
    public function incorrectDefaultThrowsException()
    {
        $netrc = <<<EOF
default machine.one login john password <PASSWORD>
EOF;
        $this->parser->parse($netrc);
    }

    /**
     * @expectedException Fduch\Netrc\Exception\ParseException
     * @test
     */
    public function incorrectKeyThrowsException()
    {
        $netrc = <<<EOF
machine machine.one logOn john password <PASSWORD>
EOF;
        $this->parser->parse($netrc);
    }

    /**
     * @expectedException Fduch\Netrc\Exception\ParseException
     * @test
     */
    public function emptyMachineNameThrowsException()
    {
        $netrc = <<<EOF
machine
EOF;
        $this->parser->parse($netrc);
    }

    /**
     * @expectedException Fduch\Netrc\Exception\ParseException
     * @test
     */
    public function unsetValueForValidKeyThrowsException()
    {
        $netrc = <<<EOF
machine machine.one login
EOF;
        $this->parser->parse($netrc);
    }

    /**
     * @expectedException Fduch\Netrc\Exception\ParseException
     * @test
     */
    public function attemptToSetInfoForUnknownMachineThrowsException()
    {
        $netrc = <<<EOF
login john
EOF;
        $this->parser->parse($netrc);
    }
}
 
{'fraction_non_alphanumeric': 0.1291155584247902, 'fraction_numerical': 0.002151925973746503, 'mean_word_length': 2.4712471994025393, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 61, 'https://': 0, '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': '5769015', 'n_tokens_mistral': 1415, 'n_tokens_neox': 1390, 'n_words': 304}