<commit_before><commit_msg>add a test for dash (-) encoding in rql string and if those are represented 1:1 in Link header..<commit_after><?php
/**
 * functional test for /core/config
 */

namespace Graviton\CoreBundle\Tests\Controller;

use Graviton\TestBundle\Test\RestTestCase;

/**
 * Basic functional test for /core/config.
 *
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
 * @link     http://swisscom.ch
 */
class ConfigControllerTest extends RestTestCase
{

    /**
     * setup client and load fixtures
     *
     * @return void
     */
    public function setUp()
    {
        $this->loadFixtures(
            array(
                'GravitonDyn\ConfigBundle\DataFixtures\MongoDB\LoadConfigData'
            ),
            null,
            'doctrine_mongodb'
        );
    }

    /**
     * We need to make sure that our Link headers are properly encoded for our RQL parser.
     * This test tries to ensure that as we have resources named-like-this in /core/config.
     *
     * @return void
     */
    public function testLinkHeaderEncoding()
    {
        $correctlyEncodedString = 'tablet%252Dhello%252Dmessage';

        $client = static::createRestClient();
        $client->request('GET', '/core/config?q=eq(id,'.$correctlyEncodedString.')');
        $response = $client->getResponse();

        $this->assertContains($correctlyEncodedString, $response->headers->get('Link'));
        $this->assertEquals(1, count($client->getResults()));
    }
}
{'fraction_non_alphanumeric': 0.12343358395989974, 'fraction_numerical': 0.005639097744360902, 'mean_word_length': 2.722610722610723, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, 'https://': 1, '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': '981404', 'n_tokens_mistral': 471, 'n_tokens_neox': 449, 'n_words': 108}