Tests are now compliant with php-cs-fixer (CamelCase for method, phpdoc valid)
This commit is contained in:
@@ -1,19 +1,22 @@
|
||||
<?php
|
||||
|
||||
/** DomFramework - Tests
|
||||
* @package domframework
|
||||
* @author Dominique Fournier <dominique@fournier38.fr>
|
||||
* @license BSD
|
||||
*/
|
||||
/**
|
||||
* DomFramework - Tests
|
||||
* @package domframework
|
||||
* @author Dominique Fournier <dominique@fournier38.fr>
|
||||
* @license BSD
|
||||
*/
|
||||
|
||||
namespace Domframework\Tests;
|
||||
|
||||
use Domframework\Outputdl;
|
||||
|
||||
/** Test the Outputdl.php file */
|
||||
/**
|
||||
* Test the Outputdl.php file
|
||||
*/
|
||||
class OutputdlTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_outputdl_init()
|
||||
public function testOutputdlInit()
|
||||
{
|
||||
exec("rm -f /tmp/testDFWoutputDL*");
|
||||
file_put_contents(
|
||||
@@ -27,9 +30,9 @@ class OutputdlTest extends \PHPUnit_Framework_TestCase
|
||||
symlink("/tmp/testDFWoutputDL", "/tmp/testDFWoutputDL3");
|
||||
}
|
||||
|
||||
public function test_outputdl_1()
|
||||
public function testOutputdl1()
|
||||
{
|
||||
// Check the full download content
|
||||
// Check the full download content
|
||||
$outputdl = new Outputdl();
|
||||
$this->expectOutputString(str_repeat(
|
||||
"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\n",
|
||||
@@ -38,18 +41,18 @@ class OutputdlTest extends \PHPUnit_Framework_TestCase
|
||||
$outputdl->downloadFile("/tmp/testDFWoutputDL");
|
||||
}
|
||||
|
||||
public function test_outputdl_Announce_1()
|
||||
public function testOutputdlAnnounce1()
|
||||
{
|
||||
// Check the announce of Resume mode Enabled
|
||||
// Check the announce of Resume mode Enabled
|
||||
$outputdl = new Outputdl();
|
||||
$outputdl->downloadFile("/tmp/testDFWoutputDL");
|
||||
$res = $outputdl->headers();
|
||||
$this->assertSame(in_array("Accept-Ranges: bytes", $res), true);
|
||||
}
|
||||
|
||||
public function test_outputdl_Announce_2()
|
||||
public function testOutputdlAnnounce2()
|
||||
{
|
||||
// Check the announce of Resume mode Disabled
|
||||
// Check the announce of Resume mode Disabled
|
||||
$outputdl = new Outputdl();
|
||||
$outputdl->resumeAllow(false);
|
||||
$outputdl->downloadFile("/tmp/testDFWoutputDL");
|
||||
@@ -57,9 +60,9 @@ class OutputdlTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertSame(in_array("Accept-Ranges: none", $res), true);
|
||||
}
|
||||
|
||||
public function test_outputdl_Partial_1()
|
||||
public function testOutputdlPartial1()
|
||||
{
|
||||
// Check the content get with provided range
|
||||
// Check the content get with provided range
|
||||
$outputdl = new Outputdl();
|
||||
$_SERVER["HTTP_RANGE"] = "bytes=3-9";
|
||||
$this->expectOutputString("4567890");
|
||||
@@ -67,9 +70,9 @@ class OutputdlTest extends \PHPUnit_Framework_TestCase
|
||||
unset($_SERVER["HTTP_RANGE"]);
|
||||
}
|
||||
|
||||
public function test_outputdl_Partial_2()
|
||||
public function testOutputdlPartial2()
|
||||
{
|
||||
// Check the content get with provided range
|
||||
// Check the content get with provided range
|
||||
$outputdl = new Outputdl();
|
||||
$_SERVER["HTTP_RANGE"] = "bytes=3-";
|
||||
$this->expectOutputString(substr(str_repeat(
|
||||
@@ -80,9 +83,9 @@ class OutputdlTest extends \PHPUnit_Framework_TestCase
|
||||
unset($_SERVER["HTTP_RANGE"]);
|
||||
}
|
||||
|
||||
public function test_outputdl_Partial_3()
|
||||
public function testOutputdlPartial3()
|
||||
{
|
||||
// Check the content get with provided range
|
||||
// Check the content get with provided range
|
||||
$outputdl = new Outputdl();
|
||||
$_SERVER["HTTP_RANGE"] = "bytes=0-";
|
||||
$this->expectOutputString(str_repeat(
|
||||
@@ -93,9 +96,9 @@ class OutputdlTest extends \PHPUnit_Framework_TestCase
|
||||
unset($_SERVER["HTTP_RANGE"]);
|
||||
}
|
||||
|
||||
public function test_outputdl_Partial_4()
|
||||
public function testOutputdlPartial4()
|
||||
{
|
||||
// Check the content get with provided range
|
||||
// Check the content get with provided range
|
||||
$outputdl = new Outputdl();
|
||||
$_SERVER["HTTP_RANGE"] = "bytes=-5";
|
||||
$this->expectOutputString("wxyz\n");
|
||||
@@ -103,9 +106,9 @@ class OutputdlTest extends \PHPUnit_Framework_TestCase
|
||||
unset($_SERVER["HTTP_RANGE"]);
|
||||
}
|
||||
|
||||
public function test_outputdl_Partial_5()
|
||||
public function testOutputdlPartial5()
|
||||
{
|
||||
// Check the content get with provided range
|
||||
// Check the content get with provided range
|
||||
$outputdl = new Outputdl();
|
||||
$_SERVER["HTTP_RANGE"] = "bytes=0-3,6-9";
|
||||
$this->expectOutputString("--Qm91bmRhcnk=\r
|
||||
@@ -124,9 +127,9 @@ Content-Type: application/octet-stream\r
|
||||
unset($_SERVER["HTTP_RANGE"]);
|
||||
}
|
||||
|
||||
public function test_outputdl_PartialWrong_1()
|
||||
public function testOutputdlPartialWrong1()
|
||||
{
|
||||
// Check the invalid provided range
|
||||
// Check the invalid provided range
|
||||
unset($_SERVER["HTTP_RANGE"]);
|
||||
$outputdl = new Outputdl();
|
||||
$_SERVER["HTTP_RANGE"] = "bytes=99999-";
|
||||
@@ -134,9 +137,9 @@ Content-Type: application/octet-stream\r
|
||||
$outputdl->downloadFile("/tmp/testDFWoutputDL");
|
||||
}
|
||||
|
||||
public function test_outputdl_PartialWrong_2()
|
||||
public function testOutputdlPartialWrong2()
|
||||
{
|
||||
// Check the invalid provided range
|
||||
// Check the invalid provided range
|
||||
unset($_SERVER["HTTP_RANGE"]);
|
||||
$outputdl = new Outputdl();
|
||||
$_SERVER["HTTP_RANGE"] = "bytes=9-3";
|
||||
@@ -144,9 +147,9 @@ Content-Type: application/octet-stream\r
|
||||
$outputdl->downloadFile("/tmp/testDFWoutputDL");
|
||||
}
|
||||
|
||||
public function test_outputdl_PartialWrong_3()
|
||||
public function testOutputdlPartialWrong3()
|
||||
{
|
||||
// Check the invalid provided range
|
||||
// Check the invalid provided range
|
||||
unset($_SERVER["HTTP_RANGE"]);
|
||||
$outputdl = new Outputdl();
|
||||
$_SERVER["HTTP_RANGE"] = "bytes=9-999999";
|
||||
@@ -154,9 +157,9 @@ Content-Type: application/octet-stream\r
|
||||
$outputdl->downloadFile("/tmp/testDFWoutputDL");
|
||||
}
|
||||
|
||||
public function test_outputdl_PartialWrong_4()
|
||||
public function testOutputdlPartialWrong4()
|
||||
{
|
||||
// Check the invalid provided range
|
||||
// Check the invalid provided range
|
||||
unset($_SERVER["HTTP_RANGE"]);
|
||||
$outputdl = new Outputdl();
|
||||
$_SERVER["HTTP_RANGE"] = "bytes=-";
|
||||
@@ -164,9 +167,9 @@ Content-Type: application/octet-stream\r
|
||||
$outputdl->downloadFile("/tmp/testDFWoutputDL");
|
||||
}
|
||||
|
||||
public function test_outputdl_invalidBase_1()
|
||||
public function testOutputdlInvalidBase1()
|
||||
{
|
||||
// Check the base comparison : OK
|
||||
// Check the base comparison : OK
|
||||
unset($_SERVER["HTTP_RANGE"]);
|
||||
$outputdl = new Outputdl();
|
||||
$outputdl->base("/tmp");
|
||||
@@ -177,9 +180,9 @@ Content-Type: application/octet-stream\r
|
||||
$outputdl->downloadFile("/tmp/testDFWoutputDL");
|
||||
}
|
||||
|
||||
public function test_outputdl_invalidBase_2()
|
||||
public function testOutputdlInvalidBase2()
|
||||
{
|
||||
// Check the base comparison : BAD
|
||||
// Check the base comparison : BAD
|
||||
unset($_SERVER["HTTP_RANGE"]);
|
||||
$outputdl = new Outputdl();
|
||||
$outputdl->base("/tmp");
|
||||
@@ -191,9 +194,9 @@ Content-Type: application/octet-stream\r
|
||||
$outputdl->downloadFile("../../../../../..//etc/passwd");
|
||||
}
|
||||
|
||||
public function test_outputdl_invalidFile_1()
|
||||
public function testOutputdlInvalidFile1()
|
||||
{
|
||||
// Check the base comparison : BAD Symlink
|
||||
// Check the base comparison : BAD Symlink
|
||||
unset($_SERVER["HTTP_RANGE"]);
|
||||
$outputdl = new Outputdl();
|
||||
$outputdl->base("/tmp");
|
||||
@@ -205,9 +208,9 @@ Content-Type: application/octet-stream\r
|
||||
$outputdl->downloadFile("/tmp/testDFWoutputDL3");
|
||||
}
|
||||
|
||||
public function test_outputdl_invalidFile_2()
|
||||
public function testOutputdlInvalidFile2()
|
||||
{
|
||||
// Check the base comparison : Non existing
|
||||
// Check the base comparison : Non existing
|
||||
unset($_SERVER["HTTP_RANGE"]);
|
||||
$outputdl = new Outputdl();
|
||||
$outputdl->base("/tmp");
|
||||
|
||||
Reference in New Issue
Block a user