<commit_before><?php

namespace Graviton\GeneratorBundle\Tests\Command;

use Symfony\Component\Console\Tester\CommandTester;
use Sensio\Bundle\GeneratorBundle\Tests\Command\GenerateBundleCommandTest as BaseTest;
use Graviton\GeneratorBundle\Command\GenerateBundleCommand;

/**
 * functional tests for graviton:generate:bundle
 *
 * @category GeneratorBundle
 * @package  Graviton
 * @author   <NAME> <<EMAIL>>
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
 * @link     http://swisscom.com
 *
 * @todo fix that updateKernel is not getting tested
 */
class GenerateBundleCommandTest extends BaseTest
{
    /**
     * test basic calls to command
     *
     * @param array  $options  options
     * @param string $input    cli input
     * @param array  $expected results to assert
     *
     * @return void
     *
     * @dataProvider getInteractiveCommandData
     */
    public function testInteractiveCommand($options, $input, $expected)
    {
        parent::testInteractiveCommand($options, $input, $expected);
    }

    /**
     * add xml test to upstreams test data
     *
     * @return array[]
     */
    public function getInteractiveCommandData()
    {
        $tmp = sys_get_temp_dir();

        return array_merge(
            parent::getInteractiveCommandData(),
            array(
                array(
                    array(
                        '--dir' => $tmp,
                        '--format' => 'xml'
                    ),
                    "Foo/BarBundle\n",
                    array('Foo\BarBundle', 'FooBarBundle', $tmp.'/', 'xml', false)
                )
            )
        );
    }

    /**
     * get command
     *
     * @param \Graviton\GeneratorBundle\Generator\BundleGenerator $generator generator
     * @param object                                              $input     input mock
     *
     * @return \Graviton\GeneratorBundle\Command\GenerateBundleCommand
     */
    protected function getCommand($generator, $input)
    {
        $command = $this
            ->getMockBuilder('Graviton\GeneratorBundle\Command\GenerateBundleCommand')
            ->setMethods(array('checkAutoloader', 'updateKernel'))
            ->getMock();

        $command->setContainer($this->getContainer());
        $command->setHelperSet($this->getHelperSet($input));
        $command->setGenerator($generator);

        return $command;
    }

    /**
     * get generator
     *
     * @return \Graviton\GeneratorBundle\Generator\BundleGenerator
     */
    protected function getGenerator()
    {
        // get a noop generator
        return $this
            ->getMockBuilder('Graviton\GeneratorBundle\Generator\BundleGenerator')
            ->disableOriginalConstructor()
            ->setMethods(array('generate'))
            ->getMock();
    }

    /**
     * get bundle
     *
     * @return \Graviton\BundleBundle\GravitonBundleInterface
     *
     * @todo move one class up
     */
    protected function getBundle()
    {
        $bundle = $this->getMock('Graviton\BundleBundle\GravitonBundleInterface');
        $bundle
            ->expects($this->any())
            ->method('getPath')
            ->will($this->returnValue(sys_get_temp_dir()));

        return $bundle;
    }
}
<commit_msg>ignore coverage info on method that is obviously called<commit_after><?php

namespace Graviton\GeneratorBundle\Tests\Command;

use Symfony\Component\Console\Tester\CommandTester;
use Sensio\Bundle\GeneratorBundle\Tests\Command\GenerateBundleCommandTest as BaseTest;
use Graviton\GeneratorBundle\Command\GenerateBundleCommand;

/**
 * functional tests for graviton:generate:bundle
 *
 * @category GeneratorBundle
 * @package  Graviton
 * @author   <NAME> <<EMAIL>>
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
 * @link     http://swisscom.com
 *
 * @todo fix that updateKernel is not getting tested
 */
class GenerateBundleCommandTest extends BaseTest
{
    /**
     * test basic calls to command
     *
     * @param array  $options  options
     * @param string $input    cli input
     * @param array  $expected results to assert
     *
     * @return void
     *
     * @dataProvider getInteractiveCommandData
     */
    public function testInteractiveCommand($options, $input, $expected)
    {
        parent::testInteractiveCommand($options, $input, $expected);
    }

    /**
     * add xml test to upstreams test data
     *
     * @return array[]
     *
     * @codeCoverageIgnore
     */
    public function getInteractiveCommandData()
    {
        $tmp = sys_get_temp_dir();

        return array_merge(
            parent::getInteractiveCommandData(),
            array(
                array(
                    array(
                        '--dir' => $tmp,
                        '--format' => 'xml'
                    ),
                    "Foo/BarBundle\n",
                    array('Foo\BarBundle', 'FooBarBundle', $tmp.'/', 'xml', false)
                )
            )
        );
    }

    /**
     * get command
     *
     * @param \Graviton\GeneratorBundle\Generator\BundleGenerator $generator generator
     * @param object                                              $input     input mock
     *
     * @return \Graviton\GeneratorBundle\Command\GenerateBundleCommand
     */
    protected function getCommand($generator, $input)
    {
        $command = $this
            ->getMockBuilder('Graviton\GeneratorBundle\Command\GenerateBundleCommand')
            ->setMethods(array('checkAutoloader', 'updateKernel'))
            ->getMock();

        $command->setContainer($this->getContainer());
        $command->setHelperSet($this->getHelperSet($input));
        $command->setGenerator($generator);

        return $command;
    }

    /**
     * get generator
     *
     * @return \Graviton\GeneratorBundle\Generator\BundleGenerator
     */
    protected function getGenerator()
    {
        // get a noop generator
        return $this
            ->getMockBuilder('Graviton\GeneratorBundle\Generator\BundleGenerator')
            ->disableOriginalConstructor()
            ->setMethods(array('generate'))
            ->getMock();
    }

    /**
     * get bundle
     *
     * @return \Graviton\BundleBundle\GravitonBundleInterface
     *
     * @todo move one class up
     */
    protected function getBundle()
    {
        $bundle = $this->getMock('Graviton\BundleBundle\GravitonBundleInterface');
        $bundle
            ->expects($this->any())
            ->method('getPath')
            ->will($this->returnValue(sys_get_temp_dir()));

        return $bundle;
    }
}

{'fraction_non_alphanumeric': 0.1147812971342383, 'fraction_numerical': 0.0, 'mean_word_length': 2.058579335793358, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5013901', 'n_tokens_mistral': 1809, 'n_tokens_neox': 1719, 'n_words': 345}