<commit_before><?php
namespace phpbu\Laravel\Cmd;

use phpbu\Laravel\Configuration\Proxy;

/**
 * Class BackupTest
 *
 * @package    phpbu\Laravel
 * @author     <NAME> <<EMAIL>>
 * @copyright  <NAME> <<EMAIL>>
 * @license    http://www.opensource.org/licenses/MIT The MIT License (MIT)
 * @link       http://phpbu.de/
 */
class BackupTest extends \PHPUnit_Framework_TestCase
{
    /**
     * Tests Cmd::fire
     */
    public function testFireOkLaravelStyle()
    {
        // create the result mok that is returned by the mock runner
        $result = $this->getMockBuilder('\\phpbu\\App\Result')
                       ->disableOriginalConstructor()
                       ->getMock();
        $result->expects($this->once())
               ->method('wasSuccessful')
               ->willReturn(true);

        // create the mock runner
        $runner = $this->getMockBuilder('\\phpbu\\App\\Runner')
                       ->disableOriginalConstructor()
                       ->getMock();
        $runner->expects($this->once())
               ->method('run')
               ->willReturn($result);

        // create a valid config proxy
        $proxy   = new Proxy(require __DIR__ . '/../../_files/config.minimal.php');

        // create a command mock so no actual option/argument parsing is done
        $command = $this->getMockBuilder('\\phpbu\\Laravel\\Cmd\\Backup')
                        ->setMethods(['option'])
                        ->setConstructorArgs([$runner, $proxy])
                        ->getMock();
        $command->expects($this->exactly(2))
                ->method('option')
                ->willReturn(false);

        $this->assertTrue($command->fire());
    }

    /**
     * Tests Cmd::fire
     *
     * @expectedException \phpbu\Laravel\Configuration\Exception
     */
    public function testLaravelStyleInvalidConfig()
    {
        // create the mock runner
        $runner = $this->getMockBuilder('\\phpbu\\App\\Runner')
                ->disableOriginalConstructor()
                ->getMock();

        // create a invalid config proxy
        $proxy   = new Proxy(require __DIR__ . '/../../_files/config.invalid.php');

        // create a command mock so no actual option/argument parsing is done
        $command = $this->getMockBuilder('\\phpbu\\Laravel\\Cmd\\Backup')
                        ->setMethods(['option'])
                        ->setConstructorArgs([$runner, $proxy])
                        ->getMock();

        $command->fire();
    }

    /**
     * Tests Cmd::fire
     */
    public function testFireOkPhpbuStyle()
    {
        // create the result mok that is returned by the mock runner
        $result = $this->getMockBuilder('\\phpbu\\App\Result')
                       ->disableOriginalConstructor()
                       ->getMock();
        $result->expects($this->once())
               ->method('wasSuccessful')
               ->willReturn(true);

        // create the mock runner
        $runner = $this->getMockBuilder('\\phpbu\\App\\Runner')
                      ->disableOriginalConstructor()
                      ->getMock();
        $runner->expects($this->once())
               ->method('run')
               ->willReturn($result);

        // create a valid config proxy
        $proxy   = new Proxy(require __DIR__ . '/../../_files/config.phpbu.php');

        // create a command mock so no actual option/argument parsing is done
        $command = $this->getMockBuilder('\\phpbu\\Laravel\\Cmd\\Backup')
                        ->setMethods(['option'])
                        ->setConstructorArgs([$runner, $proxy])
                        ->getMock();
        $command->expects($this->exactly(2))
                ->method('option')
                ->willReturn(false);

        $this->assertTrue($command->fire());
    }
}<commit_msg>Fix unit test after adding the 'phpbu-simulate' option<commit_after><?php
namespace phpbu\Laravel\Cmd;

use phpbu\Laravel\Configuration\Proxy;

/**
 * Class BackupTest
 *
 * @package    phpbu\Laravel
 * @author     <NAME> <<EMAIL>>
 * @copyright  <NAME> <<EMAIL>>
 * @license    http://www.opensource.org/licenses/MIT The MIT License (MIT)
 * @link       http://phpbu.de/
 */
class BackupTest extends \PHPUnit_Framework_TestCase
{
    /**
     * Tests Cmd::fire
     */
    public function testFireOkLaravelStyle()
    {
        // create the result mok that is returned by the mock runner
        $result = $this->getMockBuilder('\\phpbu\\App\Result')
                       ->disableOriginalConstructor()
                       ->getMock();
        $result->expects($this->once())
               ->method('wasSuccessful')
               ->willReturn(true);

        // create the mock runner
        $runner = $this->getMockBuilder('\\phpbu\\App\\Runner')
                       ->disableOriginalConstructor()
                       ->getMock();
        $runner->expects($this->once())
               ->method('run')
               ->willReturn($result);

        // create a valid config proxy
        $proxy   = new Proxy(require __DIR__ . '/../../_files/config.minimal.php');

        // create a command mock so no actual option/argument parsing is done
        $command = $this->getMockBuilder('\\phpbu\\Laravel\\Cmd\\Backup')
                        ->setMethods(['option'])
                        ->setConstructorArgs([$runner, $proxy])
                        ->getMock();
        $command->expects($this->exactly(4))
                ->method('option')
                ->willReturn(false);

        $this->assertTrue($command->fire());
    }

    /**
     * Tests Cmd::fire
     *
     * @expectedException \phpbu\Laravel\Configuration\Exception
     */
    public function testLaravelStyleInvalidConfig()
    {
        // create the mock runner
        $runner = $this->getMockBuilder('\\phpbu\\App\\Runner')
                ->disableOriginalConstructor()
                ->getMock();

        // create a invalid config proxy
        $proxy   = new Proxy(require __DIR__ . '/../../_files/config.invalid.php');

        // create a command mock so no actual option/argument parsing is done
        $command = $this->getMockBuilder('\\phpbu\\Laravel\\Cmd\\Backup')
                        ->setMethods(['option'])
                        ->setConstructorArgs([$runner, $proxy])
                        ->getMock();

        $command->fire();
    }

    /**
     * Tests Cmd::fire
     */
    public function testFireOkPhpbuStyle()
    {
        // create the result mok that is returned by the mock runner
        $result = $this->getMockBuilder('\\phpbu\\App\Result')
                       ->disableOriginalConstructor()
                       ->getMock();
        $result->expects($this->once())
               ->method('wasSuccessful')
               ->willReturn(true);

        // create the mock runner
        $runner = $this->getMockBuilder('\\phpbu\\App\\Runner')
                      ->disableOriginalConstructor()
                      ->getMock();
        $runner->expects($this->once())
               ->method('run')
               ->willReturn($result);

        // create a valid config proxy
        $proxy   = new Proxy(require __DIR__ . '/../../_files/config.phpbu.php');

        // create a command mock so no actual option/argument parsing is done
        $command = $this->getMockBuilder('\\phpbu\\Laravel\\Cmd\\Backup')
                        ->setMethods(['option'])
                        ->setConstructorArgs([$runner, $proxy])
                        ->getMock();
        $command->expects($this->exactly(3))
                ->method('option')
                ->willReturn(false);

        $this->assertTrue($command->fire());
    }
}
{'fraction_non_alphanumeric': 0.14870997018021523, 'fraction_numerical': 0.000518604952677298, 'mean_word_length': 1.664594127806563, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 127, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3090961', 'n_tokens_mistral': 2042, 'n_tokens_neox': 1948, 'n_words': 407}