<commit_before><?php

namespace Neptune\Tests\EventListener;

require_once __DIR__ . '/../../../bootstrap.php';

use Neptune\Security\SecurityRequestListener;

use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpFoundation\Request;

/**
 * SecurityRequestListenerTest
 *
 * @author <NAME> <<EMAIL>>
 **/
class SecurityRequestListenerTest extends \PHPUnit_Framework_TestCase
{

    public function setUp()
    {
        $this->factory = $this->getMockBuilder('Neptune\Security\SecurityFactory')
                              ->disableOriginalConstructor()
                              ->getMock();
        $this->listener = new SecurityRequestListener($this->factory);
    }

    public function testOnKernelRequest()
    {
        $request = new Request();
        $event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent')
                      ->disableOriginalConstructor()
                      ->getMock();

        $event->expects($this->once())
              ->method('getRequest')
              ->will($this->returnValue($request));

        $this->factory->expects($this->once())
                      ->method('setRequest')
                      ->with($request);

        $this->listener->onKernelRequest($event);
    }

    public function testGetSubscribedEvents()
    {
        $expected = array(KernelEvents::REQUEST => array('onKernelRequest'));
        $this->assertSame($expected, SecurityRequestListener::getSubscribedEvents());
    }

}
<commit_msg>Updating SecurityRequestListenerTest for previous commit.<commit_after><?php

namespace Neptune\Tests\EventListener;

require_once __DIR__ . '/../../../bootstrap.php';

use Neptune\Security\SecurityRequestListener;

use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpFoundation\Request;

/**
 * SecurityRequestListenerTest
 *
 * @author <NAME> <<EMAIL>>
 **/
class SecurityRequestListenerTest extends \PHPUnit_Framework_TestCase
{

    public function setUp()
    {
        $this->factory = $this->getMockBuilder('Neptune\Security\SecurityFactory')
                              ->disableOriginalConstructor()
                              ->getMock();
        $this->listener = new SecurityRequestListener($this->factory);
    }

    public function testOnKernelRequest()
    {
        $request = new Request();
        $event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent')
                      ->disableOriginalConstructor()
                      ->getMock();

        $event->expects($this->once())
              ->method('isMasterRequest')
              ->will($this->returnValue(true));
        $event->expects($this->once())
              ->method('getRequest')
              ->will($this->returnValue($request));

        $this->factory->expects($this->once())
                      ->method('setRequest')
                      ->with($request);

        $this->listener->onKernelRequest($event);
    }

    public function testGetSubscribedEvents()
    {
        $expected = array(KernelEvents::REQUEST => array('onKernelRequest'));
        $this->assertSame($expected, SecurityRequestListener::getSubscribedEvents());
    }

}

{'fraction_non_alphanumeric': 0.13692446584411677, 'fraction_numerical': 0.0, 'mean_word_length': 2.6209150326797386, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 60, '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': '5628856', 'n_tokens_mistral': 846, 'n_tokens_neox': 827, 'n_words': 121}