<commit_before><?php

namespace spec\PhpSpec\Laravel\Extension;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use PhpSpec\ServiceContainer;

class LaravelExtensionSpec extends ObjectBehavior
{
    function let(ServiceContainer $container)
    {
        $container->setShared(Argument::cetera())->willReturn();
    }

    function it_is_a_phpspec_extension()
    {
        $this->shouldHaveType('PhpSpec\Extension\ExtensionInterface');
    }

    function it_registers_the_laravel_kernel(ServiceContainer $container)
    {
        $container
            ->setShared('laravel', Argument::type('Closure'))
            ->shouldBeCalled();

        $this->load($container);
    }

    function it_registers_the_laravel_maintainer(ServiceContainer $container)
    {
        $container
            ->setShared('runner.maintainers.laravel', Argument::type('Closure'))
            ->shouldBeCalled();

        $this->load($container);
    }

    function it_registers_the_presenter_maintainer(ServiceContainer $container)
    {
        $container
            ->setShared('runner.maintainers.presenter', Argument::type('Closure'))
            ->shouldBeCalled();

        $this->load($container);
    }

    function it_registers_the_laravel_listener(ServiceContainer $container)
    {
        $container
            ->setShared('event_dispatcher.listeners.laravel', Argument::type('Closure'))
            ->shouldBeCalled();

        $this->load($container);
    }
    
    function it_gets_application_base_path()
    {
        $folderAboveVendor = realpath(__DIR__ . '/../../../../../../..');
        $this->getBasePath()->shouldBe($folderAboveVendor);
    }

    function it_gets_base_path_relative_to_vendor()
    {
        $this->getBasePath('laravel/laravel')->shouldEndWith('vendor/laravel/laravel');
    }

    function it_gets_absolute_base_path()
    {
        $this->getBasePath('/foo/bar')->shouldBe('/foo/bar');
    }
    
    function it_throws_exception_if_base_path_is_not_found()
    {
        $this->shouldThrow('InvalidArgumentException')->during('validateBasePath', ['foo']);
    }

    public function getMatchers()
    {
        return [
            'endWith' => function($subject, $value) {
                return ($value === substr($subject, -strlen($value)));
            }
        ];
    }

}
<commit_msg>fix it_gets_base_path_relative_to_vendor test<commit_after><?php

namespace spec\PhpSpec\Laravel\Extension;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use PhpSpec\ServiceContainer;

class LaravelExtensionSpec extends ObjectBehavior
{
    function let(ServiceContainer $container)
    {
        $container->setShared(Argument::cetera())->willReturn();
    }

    function it_is_a_phpspec_extension()
    {
        $this->shouldHaveType('PhpSpec\Extension\ExtensionInterface');
    }

    function it_registers_the_laravel_kernel(ServiceContainer $container)
    {
        $container
            ->setShared('laravel', Argument::type('Closure'))
            ->shouldBeCalled();

        $this->load($container);
    }

    function it_registers_the_laravel_maintainer(ServiceContainer $container)
    {
        $container
            ->setShared('runner.maintainers.laravel', Argument::type('Closure'))
            ->shouldBeCalled();

        $this->load($container);
    }

    function it_registers_the_presenter_maintainer(ServiceContainer $container)
    {
        $container
            ->setShared('runner.maintainers.presenter', Argument::type('Closure'))
            ->shouldBeCalled();

        $this->load($container);
    }

    function it_registers_the_laravel_listener(ServiceContainer $container)
    {
        $container
            ->setShared('event_dispatcher.listeners.laravel', Argument::type('Closure'))
            ->shouldBeCalled();

        $this->load($container);
    }
    
    function it_gets_application_base_path()
    {
        $folderAboveVendor = realpath(__DIR__ . '/../../../../../../..');
        $this->getBasePath()->shouldBe($folderAboveVendor);
    }

    function it_gets_base_path_relative_to_vendor()
    {
        $this->getBasePath('laravel/laravel')->shouldEndWith('laravel/laravel');
    }

    function it_gets_absolute_base_path()
    {
        $this->getBasePath('/foo/bar')->shouldBe('/foo/bar');
    }
    
    function it_throws_exception_if_base_path_is_not_found()
    {
        $this->shouldThrow('InvalidArgumentException')->during('validateBasePath', ['foo']);
    }

    public function getMatchers()
    {
        return [
            'endWith' => function($subject, $value) {
                return ($value === substr($subject, -strlen($value)));
            }
        ];
    }

}

{'fraction_non_alphanumeric': 0.13779107028412732, 'fraction_numerical': 0.0, 'mean_word_length': 2.8440065681444993, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 51, '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': '5321708', 'n_tokens_mistral': 1379, 'n_tokens_neox': 1338, 'n_words': 158}