<commit_before><?php

namespace Herrera\Box\Tests;

use Herrera\Box\StubGenerator;
use Herrera\PHPUnit\TestCase;
use Phar;

class StubGeneratorTest extends TestCase
{
    /**
     * @var StubGenerator
     */
    private $generator;

    public function testAlias()
    {
        $this->generator->alias('test.phar');

        $this->assertEquals(
            'test.phar',
            $this->getPropertyValue($this->generator, 'alias')
        );
    }

    public function testBanner()
    {
        $this->generator->banner('Phar creation

does work


  indented');

        $this->assertEquals(
            'Phar creation

does work


  indented',
            $this->getPropertyValue($this->generator, 'banner')
        );

        $this->assertEquals(
            <<<STUB
#!/usr/bin/env php
<?php
/**
 * Phar creation
 *
 * does work
 *
 *
 *   indented
 */
__HALT_COMPILER();
STUB
            ,
            $this->generator->generate()
        );
    }

    public function testCreate()
    {
        $this->assertInstanceOf(
            'Herrera\\Box\\StubGenerator',
            StubGenerator::create()
        );
    }

    public function testIndex()
    {
        $this->generator->index('index.php');

        $this->assertEquals(
            'index.php',
            $this->getPropertyValue($this->generator, 'index')
        );
    }

    public function testIntercept()
    {
        $this->generator->intercept(true);

        $this->assertTrue(
            $this->getPropertyValue(
                $this->generator,
                'intercept'
            )
        );
    }

    public function testGenerate()
    {<commit_msg>Adding missing extract() test.<commit_after><?php

namespace Herrera\Box\Tests;

use Herrera\Box\StubGenerator;
use Herrera\PHPUnit\TestCase;
use Phar;

class StubGeneratorTest extends TestCase
{
    /**
     * @var StubGenerator
     */
    private $generator;

    public function testAlias()
    {
        $this->generator->alias('test.phar');

        $this->assertEquals(
            'test.phar',
            $this->getPropertyValue($this->generator, 'alias')
        );
    }

    public function testBanner()
    {
        $this->generator->banner('Phar creation

does work


  indented');

        $this->assertEquals(
            'Phar creation

does work


  indented',
            $this->getPropertyValue($this->generator, 'banner')
        );

        $this->assertEquals(
            <<<STUB
#!/usr/bin/env php
<?php
/**
 * Phar creation
 *
 * does work
 *
 *
 *   indented
 */
__HALT_COMPILER();
STUB
            ,
            $this->generator->generate()
        );
    }

    public function testCreate()
    {
        $this->assertInstanceOf(
            'Herrera\\Box\\StubGenerator',
            StubGenerator::create()
        );
    }

    public function testExtract()
    {
        $this->generator->extract(true);

        $this->assertTrue(
            $this->getPropertyValue(
                $this->generator,
                'extract'
            )
        );
    }

    public function testIndex()
    {
        $this->generator->index('index.php');

        $this->assertEquals(
            'index.php',
            $this->getPropertyValue($this->generator, 'index')
        );
    }

    public function testIntercept()
    {
        $this->generator->intercept(true);

        $this->assertTrue(
            $this->getPropertyValue(
                $this->generator,
                'intercept'
            )
        );
    }

    public function testGenerate()
    {
{'fraction_non_alphanumeric': 0.13434942139429862, 'fraction_numerical': 0.0, 'mean_word_length': 1.7387944358578054, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 56, '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': '5520259', 'n_tokens_mistral': 1031, 'n_tokens_neox': 1004, 'n_words': 169}