<commit_before><?php
/**
 * Created by PhpStorm.
 * User: jjose00
 * Date: 11/16/17
 * Time: 4:18 PM
 */

namespace Giftcards\Encryption\Tests\Command;

use Giftcards\Encryption\CipherText\Rotator\Bounds;
use Giftcards\Encryption\CipherText\Rotator\ConsoleOutputRotatorObserver;
use Giftcards\Encryption\CipherText\Rotator\Rotator;
use Giftcards\Encryption\CipherText\Rotator\RotatorObserverChain;
use Giftcards\Encryption\Command\RotateRangeInStoreCommand;
use Giftcards\Encryption\Tests\AbstractTestCase;
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\ConsoleOutput;

class RotateStoreTest extends AbstractTestCase
{

    public function testCommand()
    {
        $storeName = $this->getFaker()->unique()->word();
        $newProfile = $this->getFaker()->unique()->word();

        $rotator = \Mockery::mock(Rotator::class);
        $rotator->shouldReceive("rotate");
        assert($rotator instanceof Rotator);

        $offset = $this->getFaker()->unique()->randomNumber();
        $limit = $this->getFaker()->unique()->randomNumber();
        $batchSize = $this->getFaker()->unique()->randomNumber();

        $command = new RotateRangeInStoreCommand($rotator);
        $input = new StringInput("{$storeName} --offset={$offset} --limit={$limit} --batch-size={$batchSize} --new-profile={$newProfile}");
        $output = new ConsoleOutput();
        $command->run($input, $output);

        $rotator->shouldHaveReceived("rotate")->withArgs([
            $storeName,
            $newProfile,<commit_msg>bad class name, pretend you didn't see that...<commit_after><?php
/**
 * Created by PhpStorm.
 * User: jjose00
 * Date: 11/16/17
 * Time: 4:18 PM
 */

namespace Giftcards\Encryption\Tests\Command;

use Giftcards\Encryption\CipherText\Rotator\Bounds;
use Giftcards\Encryption\CipherText\Rotator\ConsoleOutputRotatorObserver;
use Giftcards\Encryption\CipherText\Rotator\Rotator;
use Giftcards\Encryption\CipherText\Rotator\RotatorObserverChain;
use Giftcards\Encryption\Command\RotateRangeInStoreCommand;
use Giftcards\Encryption\Tests\AbstractTestCase;
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\ConsoleOutput;

class RotateRangeTest extends AbstractTestCase
{

    public function testCommand()
    {
        $storeName = $this->getFaker()->unique()->word();
        $newProfile = $this->getFaker()->unique()->word();

        $rotator = \Mockery::mock(Rotator::class);
        $rotator->shouldReceive("rotate");
        assert($rotator instanceof Rotator);

        $offset = $this->getFaker()->unique()->randomNumber();
        $limit = $this->getFaker()->unique()->randomNumber();
        $batchSize = $this->getFaker()->unique()->randomNumber();

        $command = new RotateRangeInStoreCommand($rotator);
        $input = new StringInput("{$storeName} --offset={$offset} --limit={$limit} --batch-size={$batchSize} --new-profile={$newProfile}");
        $output = new ConsoleOutput();
        $command->run($input, $output);

        $rotator->shouldHaveReceived("rotate")->withArgs([
            $storeName,
            $newProfile,
{'fraction_non_alphanumeric': 0.1550015979546181, 'fraction_numerical': 0.007031000319590924, 'mean_word_length': 4.072933549432739, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 41, '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': '7199717', 'n_tokens_mistral': 952, 'n_tokens_neox': 912, 'n_words': 146}