Passage en Namespace et tous les tests fonctionnels OK
This commit is contained in:
@@ -7,8 +7,10 @@
|
||||
|
||||
namespace Domframework\Tests;
|
||||
|
||||
/** Test the outputdl.php file */
|
||||
class outputdlTest extends \PHPUnit_Framework_TestCase
|
||||
use Domframework\Outputdl;
|
||||
|
||||
/** Test the Outputdl.php file */
|
||||
class OutputdlTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_outputdl_init ()
|
||||
{
|
||||
@@ -25,7 +27,7 @@ class outputdlTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_outputdl_1 ()
|
||||
{
|
||||
// Check the full download content
|
||||
$outputdl = new outputdl ();
|
||||
$outputdl = new Outputdl ();
|
||||
$this->expectOutputString (str_repeat (
|
||||
"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\n",
|
||||
1000));
|
||||
@@ -35,7 +37,7 @@ class outputdlTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_outputdl_Announce_1 ()
|
||||
{
|
||||
// Check the announce of Resume mode Enabled
|
||||
$outputdl = new outputdl ();
|
||||
$outputdl = new Outputdl ();
|
||||
$outputdl->downloadFile ("/tmp/testDFWoutputDL");
|
||||
$res = $outputdl->headers ();
|
||||
$this->assertSame (in_array ("Accept-Ranges: bytes", $res), true);
|
||||
@@ -44,7 +46,7 @@ class outputdlTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_outputdl_Announce_2 ()
|
||||
{
|
||||
// Check the announce of Resume mode Disabled
|
||||
$outputdl = new outputdl ();
|
||||
$outputdl = new Outputdl ();
|
||||
$outputdl->resumeAllow (false);
|
||||
$outputdl->downloadFile ("/tmp/testDFWoutputDL");
|
||||
$res = $outputdl->headers ();
|
||||
@@ -54,7 +56,7 @@ class outputdlTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_outputdl_Partial_1 ()
|
||||
{
|
||||
// Check the content get with provided range
|
||||
$outputdl = new outputdl ();
|
||||
$outputdl = new Outputdl ();
|
||||
$_SERVER["HTTP_RANGE"] = "bytes=3-9";
|
||||
$this->expectOutputString ("4567890");
|
||||
$outputdl->downloadFile ("/tmp/testDFWoutputDL");
|
||||
@@ -64,7 +66,7 @@ class outputdlTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_outputdl_Partial_2 ()
|
||||
{
|
||||
// Check the content get with provided range
|
||||
$outputdl = new outputdl ();
|
||||
$outputdl = new Outputdl ();
|
||||
$_SERVER["HTTP_RANGE"] = "bytes=3-";
|
||||
$this->expectOutputString (substr (str_repeat (
|
||||
"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\n",
|
||||
@@ -76,7 +78,7 @@ class outputdlTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_outputdl_Partial_3 ()
|
||||
{
|
||||
// Check the content get with provided range
|
||||
$outputdl = new outputdl ();
|
||||
$outputdl = new Outputdl ();
|
||||
$_SERVER["HTTP_RANGE"] = "bytes=0-";
|
||||
$this->expectOutputString (str_repeat (
|
||||
"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\n",
|
||||
@@ -88,7 +90,7 @@ class outputdlTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_outputdl_Partial_4 ()
|
||||
{
|
||||
// Check the content get with provided range
|
||||
$outputdl = new outputdl ();
|
||||
$outputdl = new Outputdl ();
|
||||
$_SERVER["HTTP_RANGE"] = "bytes=-5";
|
||||
$this->expectOutputString ("wxyz\n");
|
||||
$outputdl->downloadFile ("/tmp/testDFWoutputDL");
|
||||
@@ -98,7 +100,7 @@ class outputdlTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_outputdl_Partial_5 ()
|
||||
{
|
||||
// Check the content get with provided range
|
||||
$outputdl = new outputdl ();
|
||||
$outputdl = new Outputdl ();
|
||||
$_SERVER["HTTP_RANGE"] = "bytes=0-3,6-9";
|
||||
$this->expectOutputString ("--Qm91bmRhcnk=\r
|
||||
Content-Range: bytes 0-3/63000\r
|
||||
@@ -120,7 +122,7 @@ Content-Type: application/octet-stream\r
|
||||
{
|
||||
// Check the invalid provided range
|
||||
unset ($_SERVER["HTTP_RANGE"]);
|
||||
$outputdl = new outputdl ();
|
||||
$outputdl = new Outputdl ();
|
||||
$_SERVER["HTTP_RANGE"] = "bytes=99999-";
|
||||
$this->expectException ("Exception", "Invalid range provided", 416);
|
||||
$outputdl->downloadFile ("/tmp/testDFWoutputDL");
|
||||
@@ -130,7 +132,7 @@ Content-Type: application/octet-stream\r
|
||||
{
|
||||
// Check the invalid provided range
|
||||
unset ($_SERVER["HTTP_RANGE"]);
|
||||
$outputdl = new outputdl ();
|
||||
$outputdl = new Outputdl ();
|
||||
$_SERVER["HTTP_RANGE"] = "bytes=9-3";
|
||||
$this->expectException ("Exception", "Invalid range provided", 416);
|
||||
$outputdl->downloadFile ("/tmp/testDFWoutputDL");
|
||||
@@ -140,7 +142,7 @@ Content-Type: application/octet-stream\r
|
||||
{
|
||||
// Check the invalid provided range
|
||||
unset ($_SERVER["HTTP_RANGE"]);
|
||||
$outputdl = new outputdl ();
|
||||
$outputdl = new Outputdl ();
|
||||
$_SERVER["HTTP_RANGE"] = "bytes=9-999999";
|
||||
$this->expectException ("Exception", "Invalid range provided", 416);
|
||||
$outputdl->downloadFile ("/tmp/testDFWoutputDL");
|
||||
@@ -150,7 +152,7 @@ Content-Type: application/octet-stream\r
|
||||
{
|
||||
// Check the invalid provided range
|
||||
unset ($_SERVER["HTTP_RANGE"]);
|
||||
$outputdl = new outputdl ();
|
||||
$outputdl = new Outputdl ();
|
||||
$_SERVER["HTTP_RANGE"] = "bytes=-";
|
||||
$this->expectException ("Exception", "Invalid range provided", 416);
|
||||
$outputdl->downloadFile ("/tmp/testDFWoutputDL");
|
||||
@@ -160,7 +162,7 @@ Content-Type: application/octet-stream\r
|
||||
{
|
||||
// Check the base comparison : OK
|
||||
unset ($_SERVER["HTTP_RANGE"]);
|
||||
$outputdl = new outputdl ();
|
||||
$outputdl = new Outputdl ();
|
||||
$outputdl->base ("/tmp");
|
||||
$this->expectOutputString (str_repeat (
|
||||
"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\n",
|
||||
@@ -172,7 +174,7 @@ Content-Type: application/octet-stream\r
|
||||
{
|
||||
// Check the base comparison : BAD
|
||||
unset ($_SERVER["HTTP_RANGE"]);
|
||||
$outputdl = new outputdl ();
|
||||
$outputdl = new Outputdl ();
|
||||
$outputdl->base ("/tmp");
|
||||
$this->expectException ("Exception",
|
||||
"Invalid file to download : out of base", 406);
|
||||
@@ -183,7 +185,7 @@ Content-Type: application/octet-stream\r
|
||||
{
|
||||
// Check the base comparison : BAD Symlink
|
||||
unset ($_SERVER["HTTP_RANGE"]);
|
||||
$outputdl = new outputdl ();
|
||||
$outputdl = new Outputdl ();
|
||||
$outputdl->base ("/tmp");
|
||||
$this->expectException ("Exception",
|
||||
"Invalid file to download : not a file", 406);
|
||||
@@ -194,7 +196,7 @@ Content-Type: application/octet-stream\r
|
||||
{
|
||||
// Check the base comparison : Non existing
|
||||
unset ($_SERVER["HTTP_RANGE"]);
|
||||
$outputdl = new outputdl ();
|
||||
$outputdl = new Outputdl ();
|
||||
$outputdl->base ("/tmp");
|
||||
$this->expectException ("Exception",
|
||||
"Invalid file to download : file doesn't exists", 404);
|
||||
|
||||
Reference in New Issue
Block a user