<commit_before><?php
/**
 * ...
 *
 * @author <NAME> <<EMAIL>>
 * @license ...
 */

namespace Colonel\Test\Configuration;

use Colonel\HttpKernel;
use Colonel\Test\Fixtures\TestServiceProvider;
use Colonel\UriRequestStrategy;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class ServiceProviderTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @covers \Colonel\HttpKernel::run
     */
    public function test_handle_is_successful_with_a_service_provider()
    {
        $app = new HttpKernel([
            'debug' => false,
            'services' => [
                'di' => [
                    // Leave empty
                ],
            ],
            'route_strategy' => UriRequestStrategy::class,
            'routes' => [
                'test_group' => [
                    'test_route' => [
                        'pattern'    => '/',
                        'controller' => function() {
                            // Some functionality...
                        },
                        'method'     => 'GET',
                    ],
                ],
            ],
            'service_providers' => [
                TestServiceProvider::class => new TestServiceProvider()
            ],
        ]);

        $app->run();

        $this->assertTrue($app->container->isSingleton(\stdClass::class, new \stdClass()));
    }

    /**
     * @covers \Colonel\HttpKernel::handle
     * @covers \Colonel\HttpKernel::run
     */
    public function test_handle_is_successful_without_a_service_provider()
    {
        $app = new HttpKernel([
            'debug' => false,
            'services' => [
                'di' => [
                    // Leave empty
                ],<commit_msg>Add missing server global `REQUEST_URI`<commit_after><?php
/**
 * ...
 *
 * @author <NAME> <<EMAIL>>
 * @license ...
 */

namespace Colonel\Test\Configuration;

use Colonel\HttpKernel;
use Colonel\Test\Fixtures\TestServiceProvider;
use Colonel\UriRequestStrategy;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class ServiceProviderTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @covers \Colonel\HttpKernel::run
     */
    public function test_handle_is_successful_with_a_service_provider()
    {
        $_SERVER['REQUEST_URI'] = '/';
        $app = new HttpKernel([
            'debug' => false,
            'services' => [
                'di' => [
                    // Leave empty
                ],
            ],
            'route_strategy' => UriRequestStrategy::class,
            'routes' => [
                'test_group' => [
                    'test_route' => [
                        'pattern'    => '/',
                        'controller' => function() {
                            // Some functionality...
                        },
                        'method'     => 'GET',
                    ],
                ],
            ],
            'service_providers' => [
                TestServiceProvider::class => new TestServiceProvider()
            ],
        ]);

        $app->run(Request::createFromGlobals());

        $this->assertTrue($app->container->isSingleton(\stdClass::class, new \stdClass()));
    }

    /**
     * @covers \Colonel\HttpKernel::handle
     * @covers \Colonel\HttpKernel::run
     */
    public function test_handle_is_successful_without_a_service_provider()
    {
        $app = new HttpKernel([
            'debug' => false,
            'services' => [
                'di' => [
                    // Leave empty
                ],
{'fraction_non_alphanumeric': 0.1322268326417704, 'fraction_numerical': 0.0, 'mean_word_length': 1.4716336295283663, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 47, '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': '5424109', 'n_tokens_mistral': 955, 'n_tokens_neox': 928, 'n_words': 147}