<commit_before><?php
/**
 * Created by PhpStorm.
 * User: daniel
 * Date: 11.10.14
 * Time: 20:20
 */

namespace Cundd\PersistentObjectStore\Server\ValueObject;

use Cundd\PersistentObjectStore\Server\Handler\Handler;
use React\Http\Request;

class SpecialHandler extends Handler
{
}

class SpecialApplication
{
}

/**
 * Tests for creating RequestInfo objects
 *
 * @package Cundd\PersistentObjectStore\Server\ValueObject
 */
class RequestInfoTest extends \PHPUnit_Framework_TestCase
{
    protected function setUp()
    {
        parent::setUp();
        class_alias('Cundd\\PersistentObjectStore\\Server\\ValueObject\\SpecialApplication',
            'Cundd\\Special\\Application');
    }


    /**
     * @test
     */
    public function differentTests()
    {
        $requestInfo = RequestInfoFactory::buildRequestInfoFromRequest(new Request('GET', '/contacts/<EMAIL>'));
        $this->assertEquals('GET', $requestInfo->getMethod());
        $this->assertEquals('contacts', $requestInfo->getDatabaseIdentifier());
        $this->assertEquals('<EMAIL>', $requestInfo->getDataIdentifier());
        $this->assertTrue($requestInfo->isReadRequest());
        $this->assertFalse($requestInfo->isWriteRequest());
        $this->assertNull($requestInfo->getSpecialHandlerAction());

        $requestInfo = RequestInfoFactory::buildRequestInfoFromRequest(new Request('HEAD', '/contacts/info@cundd.<EMAIL>'));
        $this->assertEquals('HEAD', $requestInfo->getMethod());
        $this->assertEquals('contacts', $requestInfo->getDatabaseIdentifier());
        $this->assertEquals('<EMAIL>', $requestInfo->getDataIdentifier());
        $this->assertTrue($requestInfo->isReadRequest());
        $this->assertFalse($requestInfo->isWriteRequest());
        $this->assertNull($requestInfo->getSpecialHandlerAction());

        $requestInfo = RequestInfoFactory::buildRequestInfoFromRequest(new Request('POST', '/contacts/info@cundd.<EMAIL>'));
        $this->assertEquals('POST', $requestInfo->getMethod());
        $this->assertEquals('contacts', $requestInfo->getDatabaseIdentifier());
        $this->assertEquals('<EMAIL>', $requestInfo->getDataIdentifier());
        $this->assertFalse($requestInfo->isReadRequest());<commit_msg>Fixed a bug in the Unit Tests<commit_after><?php
/**
 * Created by PhpStorm.
 * User: daniel
 * Date: 11.10.14
 * Time: 20:20
 */

namespace Cundd\PersistentObjectStore\Server\ValueObject;

use Cundd\PersistentObjectStore\Server\Handler\Handler;
use React\Http\Request;

class SpecialHandler extends Handler
{
}

class SpecialApplication
{
}

/**
 * Tests for creating RequestInfo objects
 *
 * @package Cundd\PersistentObjectStore\Server\ValueObject
 */
class RequestInfoTest extends \PHPUnit_Framework_TestCase
{
    public static function setUpBeforeClass()
    {
        parent::setUpBeforeClass();
        class_alias('Cundd\\PersistentObjectStore\\Server\\ValueObject\\SpecialApplication',
            'Cundd\\Special\\Application');
    }


    /**
     * @test
     */
    public function differentTests()
    {
        $requestInfo = RequestInfoFactory::buildRequestInfoFromRequest(new Request('GET', '/contacts/info@<EMAIL>.<EMAIL>'));
        $this->assertEquals('GET', $requestInfo->getMethod());
        $this->assertEquals('contacts', $requestInfo->getDatabaseIdentifier());
        $this->assertEquals('<EMAIL>', $requestInfo->getDataIdentifier());
        $this->assertTrue($requestInfo->isReadRequest());
        $this->assertFalse($requestInfo->isWriteRequest());
        $this->assertNull($requestInfo->getSpecialHandlerAction());

        $requestInfo = RequestInfoFactory::buildRequestInfoFromRequest(new Request('HEAD', '/contacts/info@cundd.net'));
        $this->assertEquals('HEAD', $requestInfo->getMethod());
        $this->assertEquals('contacts', $requestInfo->getDatabaseIdentifier());
        $this->assertEquals('<EMAIL>', $requestInfo->getDataIdentifier());
        $this->assertTrue($requestInfo->isReadRequest());
        $this->assertFalse($requestInfo->isWriteRequest());
        $this->assertNull($requestInfo->getSpecialHandlerAction());

        $requestInfo = RequestInfoFactory::buildRequestInfoFromRequest(new Request('POST', '/contacts/<EMAIL>'));
        $this->assertEquals('POST', $requestInfo->getMethod());
        $this->assertEquals('contacts', $requestInfo->getDatabaseIdentifier());
        $this->assertEquals('<EMAIL>', $requestInfo->getDataIdentifier());
        $this->assertFalse($requestInfo->isReadRequest());
{'fraction_non_alphanumeric': 0.15873721654068476, 'fraction_numerical': 0.004446420631391729, 'mean_word_length': 4.433574879227053, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 79, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '3131614', 'n_tokens_mistral': 1209, 'n_tokens_neox': 1202, 'n_words': 166}