<commit_before><?php

namespace Saxulum\SaxulumControllerProvider\Provider;

use Saxulum\SaxulumControllerProvider\Map\Controller;
use Saxulum\SaxulumControllerProvider\Map\Method;
use Silex\Application;
use Silex\Provider\ServiceControllerServiceProvider;
use Silex\WebTestCase;

class SaxulumControllerProviderTest extends WebTestCase
{
    public function testInjectController()
    {
        $client = $this->createClient();

        $client->request('GET', '/container');
        $this->assertTrue($client->getResponse()->isOk());
        $this->assertEquals('ok', $client->getResponse()->getContent());

        $client->request('GET', '/service');
        $this->assertTrue($client->getResponse()->isOk());
        $this->assertEquals('ok', $client->getResponse()->getContent());
    }

    public function createApplication()
    {
        $app = new Application();
        $app['debug'] = true;

        $app->register(new ServiceControllerServiceProvider());
        $app->register(new SaxulumControllerProvider());

        $controller = new Controller();
        $controller->setNamespace('Saxulum\SaxulumControllerProvider\Controller\ContainerExampleController');
        $controller->setServiceId('saxulum.saxulumcontrollerprovider.controller.containerinjectcontroller');
        $controller->setInjectContainer(true);
        $app['controller.map']->addController($controller);

        $method = new Method();
        $method->setName('setTestData');
        $method->setInjectionKeys(array('test.data'));

        $controller = new Controller();
        $controller->setNamespace('Saxulum\SaxulumControllerProvider\Controller\ServiceExampleController');
        $controller->setServiceId('saxulum.saxulumcontrollerprovider.controller.serviceController');
        $controller->setInjectionKeys(array('test.data'));
        $controller->addMethod($method);
        $app['controller.map']->addController($controller);

        $app['test.data'] = array(
            'key1' => 'value1'
        );

        return $app;
    }
}
<commit_msg>change test to stackable controller and method<commit_after><?php

namespace Saxulum\SaxulumControllerProvider\Provider;

use Saxulum\SaxulumControllerProvider\Map\Map;
use Saxulum\SaxulumControllerProvider\Map\Controller;
use Saxulum\SaxulumControllerProvider\Map\Method;
use Silex\Application;
use Silex\Provider\ServiceControllerServiceProvider;
use Silex\WebTestCase;

class SaxulumControllerProviderTest extends WebTestCase
{
    public function testInjectController()
    {
        $client = $this->createClient();

        $client->request('GET', '/container');
        $this->assertTrue($client->getResponse()->isOk());
        $this->assertEquals('ok', $client->getResponse()->getContent());

        $client->request('GET', '/service');
        $this->assertTrue($client->getResponse()->isOk());
        $this->assertEquals('ok', $client->getResponse()->getContent());
    }

    public function createApplication()
    {
        $app = new Application();
        $app['debug'] = true;

        $app->register(new ServiceControllerServiceProvider());
        $app->register(new SaxulumControllerProvider());

        $map = $app['controller.map'];
        /** @var Map $map */

        $map
            ->addController(new Controller)
                ->setNamespace('Saxulum\SaxulumControllerProvider\Controller\ContainerExampleController')
                ->setServiceId('saxulum.saxulumcontrollerprovider.controller.containerinjectcontroller')
                ->setInjectContainer(true)
            ->end()
                ->addController(new Controller)
                ->setNamespace('Saxulum\SaxulumControllerProvider\Controller\ServiceExampleController')
                ->setServiceId('saxulum.saxulumcontrollerprovider.controller.serviceController')
                ->setInjectionKeys(array('test.data'))
                ->addMethod(new Method)
                    ->setName('setTestData1')
                    ->setInjectionKeys(array('test.data'))
                ->end()
                ->addMethod(new Method)
                    ->setName('setTestData2')
                    ->setInjectionKeys(array('test.data'))
                ->end()
            ->end()
        ;

        $app['test.data'] = array(
            'key1' => 'value1'
        );

        return $app;
    }
}

{'fraction_non_alphanumeric': 0.1408871523787635, 'fraction_numerical': 0.001378993334865548, 'mean_word_length': 3.0559179869524695, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 68, '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': '2565424', 'n_tokens_mistral': 1125, 'n_tokens_neox': 1102, 'n_words': 156}