Remove obsolete files
This commit is contained in:
@@ -1,88 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace EP\EpTrack\Tests\Unit\Userfunction;
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2016 Björn Fromme <[email protected]>, dreipunktnull
|
||||
*
|
||||
* All rights reserved
|
||||
*
|
||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||
* free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The GNU General Public License can be found at
|
||||
* http://www.gnu.org/copyleft/gpl.html.
|
||||
*
|
||||
* This script is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
use EP\EpTrack\Userfunction\RequestHandler;
|
||||
use TYPO3\CMS\Core\Tests\UnitTestCase;
|
||||
|
||||
class RequestHandlerTest extends UnitTestCase
|
||||
{
|
||||
|
||||
public function testIgnoresUrlsWithoutTrackingCode()
|
||||
{
|
||||
$handler = $this->getHandlerInstance();
|
||||
|
||||
$uriWithoutTrackingCode = '/foo/bar?baz=1234';
|
||||
$redirect = $handler->parseUri($uriWithoutTrackingCode);
|
||||
$this->assertNull($redirect);
|
||||
}
|
||||
|
||||
public function testRedirectsWithValidTrackingCodeInUrl()
|
||||
{
|
||||
$handler = $this->getHandlerInstance();
|
||||
|
||||
$uriWithoutTrackingCode = '/foo/bar/abcd1234foo';
|
||||
$redirect = $handler->parseUri($uriWithoutTrackingCode);
|
||||
$this->assertEquals($redirect, '/foo/bar/');
|
||||
|
||||
$uriWithoutTrackingCode = '/abcd1234foo';
|
||||
$redirect = $handler->parseUri($uriWithoutTrackingCode);
|
||||
$this->assertEquals($redirect, '/');
|
||||
}
|
||||
|
||||
public function testRedirectsWithValidTrackingCodeInQueryString()
|
||||
{
|
||||
$handler = $this->getHandlerInstance();
|
||||
|
||||
$uriWithoutTrackingCode = '/foo/bar/?trk=abcd1234foo';
|
||||
$redirect = $handler->parseUri($uriWithoutTrackingCode);
|
||||
$this->assertEquals($redirect, '/foo/bar/');
|
||||
}
|
||||
|
||||
public function testRedirectsWithValidTrackingCodeInUrlAndAdditionalQueryString()
|
||||
{
|
||||
$handler = $this->getHandlerInstance();
|
||||
|
||||
$uriWithoutTrackingCode = '/foo/bar/abcd1234foo?bar=baz';
|
||||
$redirect = $handler->parseUri($uriWithoutTrackingCode);
|
||||
$this->assertEquals($redirect, '/foo/bar/?bar=baz');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RequestHandler
|
||||
*/
|
||||
protected function getHandlerInstance()
|
||||
{
|
||||
$handler = new RequestHandler();
|
||||
$cookieUtility = $this->getMockObjectGenerator()->getMock('\EP\EpTrack\Utility\CookieUtility');
|
||||
$cookieUtility->expects($this->any())->method('setCookie');
|
||||
$this->inject($handler, 'cookieUtility', $cookieUtility);
|
||||
return $handler;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
// Register composer autoloader
|
||||
if (!file_exists(__DIR__ . '/../vendor/autoload.php')) {
|
||||
throw new \RuntimeException(
|
||||
'Could not find vendor/autoload.php, make sure you ran composer.'
|
||||
);
|
||||
}
|
||||
|
||||
/** @var Composer\Autoload\ClassLoader $autoloader */
|
||||
$autoloader = require __DIR__ . '/../vendor/autoload.php';
|
||||
$autoloader->addPsr4('EP\\EpTrack\\Tests\\Unit\\', __DIR__ . '/Unit/');
|
||||
Reference in New Issue
Block a user