<commit_before><?php

namespace Bolt\Tests\Nut;

use Bolt\Nut\ExtensionsSetup;
use Bolt\Tests\BoltUnitTest;
use Symfony\Component\Console\Tester\CommandTester;

/**
 * Class to test Bolt\Nut\ExtensionsSetup class.
 *
 * @author <NAME> <<EMAIL>>
 */
class ExtensionsSetupTest extends BoltUnitTest
{
    public function testRun()
    {
        $app = $this->getApp();
        $app['extend.action.options']->set('optimize-autoloader', true);

        $command = new ExtensionsSetup($app);
        $tester = new CommandTester($command);

        $tester->execute([]);
        $result = $tester->getDisplay();

        $this->assertRegExp('/Creating\/updating composer.json… \[DONE\]/', $result);

        $this->assertRegExp('/Updating autoloaders… \[DONE\]/', $result);
        $this->assertRegExp('/Generating optimized autoload files/', $result);
        $this->assertRegExp('/PackageEventListener::dump/', $result);
    }
}
<commit_msg>[Tests] Reduce ExtensionsSetupTest to SUT only<commit_after><?php

namespace Bolt\Tests\Nut;

use Bolt\Nut\ExtensionsSetup;
use Bolt\Nut\Helper\ContainerHelper;
use PHPUnit\Framework\TestCase;
use Pimple as Container;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Tester\CommandTester;

/**
 * @covers \Bolt\Nut\ExtensionsSetup
 *
 * @author <NAME> <<EMAIL>>
 */
class ExtensionsSetupTest extends TestCase
{
    public function testRun()
    {
        $jsonMock = $this->getMockBuilder(\stdClass::class)
            ->setMethods(['update'])
            ->getMock()
        ;
        $jsonMock->expects($this->once())->method('update')->willReturn(0);
        $actionMock = $this->getMockBuilder(\stdClass::class)
            ->setMethods(['execute'])
            ->getMock()
        ;
        $actionMock->expects($this->once())->method('execute')->willReturn(0);
        $ioMock = $this->getMockBuilder(\stdClass::class)
            ->setMethods(['getOutput'])
            ->getMock()
        ;
        $ioMock->expects($this->once())->method('getOutput');

        $container = new Container();
        $container['extend.manager.json'] = $jsonMock;
        $container['extend.action'] = ['autoload' => $actionMock];
        $container['extend.action.io'] = $ioMock;

        $helper = new ContainerHelper($container);
        $command = new ExtensionsSetup();
        $command->setHelperSet(new HelperSet([$helper]));
        $tester = new CommandTester($command);

        $tester->execute([]);
        $result = $tester->getDisplay();

        $this->assertRegExp('/Creating\/updating composer.json… \[DONE\]/', $result);
        $this->assertRegExp('/Updating autoloaders… \[DONE\]/', $result);
    }
}

{'fraction_non_alphanumeric': 0.172954800149421, 'fraction_numerical': 0.0007471049682480389, 'mean_word_length': 3.158385093167702, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 43, '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': '6952266', 'n_tokens_mistral': 822, 'n_tokens_neox': 810, 'n_words': 133}