<commit_before><?php

/*
 * This file is part of ConfigServiceProvider.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

use Silex\Application;
use Igorw\Silex\ConfigServiceProvider;

/**
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 */
class ConfigServiceProviderTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @dataProvider provideFilenames
     */
    public function testRegisterWithoutReplacement($filename)
    {
        $app = new Application();

        $app->register(new ConfigServiceProvider($filename));

        $this->assertSame(true, $app['debug']);
        $this->assertSame('%data%', $app['data']);
    }

    /**
     * @dataProvider provideFilenames
     */
    public function testRegisterWithReplacement($filename)
    {
        $app = new Application();

        $app->register(new ConfigServiceProvider(__DIR__."/Fixtures/config.json", array(
            'data' => 'test-replacement'
        )));

        $this->assertSame(true, $app['debug']);
        $this->assertSame('test-replacement', $app['data']);
    }

    /**
     * @dataProvider provideEmptyFilenames
     */
    public function testEmptyConfigs($filename)
    {
        $readConfigMethod = new \ReflectionMethod('Igorw\Silex\ConfigServiceProvider', 'readConfig');
        $readConfigMethod->setAccessible(true);<commit_msg>Use provideFilenames provider<commit_after><?php

/*
 * This file is part of ConfigServiceProvider.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

use Silex\Application;
use Igorw\Silex\ConfigServiceProvider;

/**
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 */
class ConfigServiceProviderTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @dataProvider provideFilenames
     */
    public function testRegisterWithoutReplacement($filename)
    {
        $app = new Application();

        $app->register(new ConfigServiceProvider($filename));

        $this->assertSame(true, $app['debug']);
        $this->assertSame('%data%', $app['data']);
    }

    /**
     * @dataProvider provideFilenames
     */
    public function testRegisterWithReplacement($filename)
    {
        $app = new Application();

        $app->register(new ConfigServiceProvider($filename, array(
            'data' => 'test-replacement'
        )));

        $this->assertSame(true, $app['debug']);
        $this->assertSame('test-replacement', $app['data']);
    }

    /**
     * @dataProvider provideEmptyFilenames
     */
    public function testEmptyConfigs($filename)
    {
        $readConfigMethod = new \ReflectionMethod('Igorw\Silex\ConfigServiceProvider', 'readConfig');
        $readConfigMethod->setAccessible(true);
{'fraction_non_alphanumeric': 0.14112343966712898, 'fraction_numerical': 0.0, 'mean_word_length': 3.2488954344624448, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 37, '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': '2551631', 'n_tokens_mistral': 823, 'n_tokens_neox': 812, 'n_words': 169}