<commit_before><?php
/**
 * This file is part of the RHDC Akamai middleware package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view
 * the LICENSE file that was distributed with this source code.
 */
namespace Rhdc\Akamai\Middleware\Response\Test;

use GuzzleHttp\Psr7\Response;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ResponseInterface;
use Rhdc\Akamai\Middleware\Response\AssertStagingMiddleware;

class AssertStagingMiddlewareTest extends TestCase
{
    /**
     * @dataProvider responseHeadersProvider
     */
    public function testPragmaHeader(array $headers, $expectException)
    {
        if ($expectException) {
            $expectExceptionFunction = method_exists($this, 'expectException') ? 'expectException' : 'setExpectedException';
            $this->$expectExceptionFunction('Rhdc\Akamai\Middleware\Response\AssertStagingMiddlewareException');

        }

        $originalResponse = new Response(200, $headers);

        $assertStagingMiddleware = new AssertStagingMiddleware();
        $modifiedResponse = $assertStagingMiddleware($originalResponse);

        if (!$expectException) {
            $this->assertTrue(
                $originalResponse instanceof ResponseInterface,
                'Returned response class is not an instance of Psr\\Http\\Message\\ResponseInterface'
            );

            $this->assertEquals(
                spl_object_hash($originalResponse),
                spl_object_hash($modifiedResponse),
                'Returned response should be the same instance'
            );<commit_msg>[AssertStagingMiddlewareTest] Fix coding style issues<commit_after><?php
/**
 * This file is part of the RHDC Akamai middleware package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view
 * the LICENSE file that was distributed with this source code.
 */
namespace Rhdc\Akamai\Middleware\Response\Test;

use GuzzleHttp\Psr7\Response;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ResponseInterface;
use Rhdc\Akamai\Middleware\Response\AssertStagingMiddleware;

class AssertStagingMiddlewareTest extends TestCase
{
    /**
     * @dataProvider responseHeadersProvider
     */
    public function testPragmaHeader(array $headers, $expectException)
    {
        if ($expectException) {
            // Allow older PHPUnit versions
            $expectExceptionFunction = method_exists($this, 'expectException')
                ? 'expectException'
                : 'setExpectedException';

            $this->$expectExceptionFunction('Rhdc\Akamai\Middleware\Response\AssertStagingMiddlewareException');
        }

        $originalResponse = new Response(200, $headers);

        $assertStagingMiddleware = new AssertStagingMiddleware();
        $modifiedResponse = $assertStagingMiddleware($originalResponse);

        if (!$expectException) {
            $this->assertTrue(
                $originalResponse instanceof ResponseInterface,
                'Returned response class is not an instance of Psr\\Http\\Message\\ResponseInterface'
            );

            $this->assertEquals(
                spl_object_hash($originalResponse),
                spl_object_hash($modifiedResponse),
                'Returned response should be the same instance'
            );
{'fraction_non_alphanumeric': 0.09151113786875377, 'fraction_numerical': 0.002408187838651415, 'mean_word_length': 2.984412470023981, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, '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': '5208889', 'n_tokens_mistral': 841, 'n_tokens_neox': 822, 'n_words': 200}