Passage en Namespace et tous les tests fonctionnels OK
This commit is contained in:
@@ -7,27 +7,29 @@
|
||||
|
||||
namespace Domframework\Tests;
|
||||
|
||||
use Domframework\Getopts;
|
||||
|
||||
/** Test the GetOpts */
|
||||
class getoptsTest extends \PHPUnit_Framework_TestCase
|
||||
class GetoptsTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_empty1 ()
|
||||
{
|
||||
// Empty
|
||||
$getopts = new getopts ();
|
||||
$getopts = new Getopts ();
|
||||
$res = $getopts->help ();
|
||||
$this->assertSame ($res, "No option defined\n");
|
||||
}
|
||||
|
||||
public function test_simu1 ()
|
||||
{
|
||||
$getopts = new getopts ();
|
||||
$getopts = new Getopts ();
|
||||
$res = $getopts->simulate ("sim\ ulate -h -d -d -f ii -o 1\ 2 -o \"2 2\" -o 3 -- -bla final");
|
||||
$this->assertSame (is_object ($res), true);
|
||||
}
|
||||
|
||||
public function test_add1 ()
|
||||
{
|
||||
$getopts = new getopts ();
|
||||
$getopts = new Getopts ();
|
||||
$getopts->simulate ("sim\ ulate -h -d -d -f ii -o 1\ 2 -o \"2 2\" -o 3 -- -bla final");
|
||||
$res = $getopts->add ("Help", "?h", array ("help","help2"), "Help of the software");
|
||||
$this->assertSame (is_object ($res), true);
|
||||
@@ -35,7 +37,7 @@ class getoptsTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_add2 ()
|
||||
{
|
||||
$getopts = new getopts ();
|
||||
$getopts = new Getopts ();
|
||||
$getopts->simulate ("sim\ ulate -h -d -d -f ii -o 1\ 2 -o \"2 2\" -o 3 -- -bla final");
|
||||
$getopts->add ("Help", "?h", array ("help","help2"), "Help of the software");
|
||||
$res = $getopts->add ("Debug", "d", "debug", "Debug", "DebugLevel", 2);
|
||||
@@ -45,7 +47,7 @@ class getoptsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_scan1 ()
|
||||
{
|
||||
$this->expectException ("Exception", "Provided tokens are not known: -f,-o,-o,-o");
|
||||
$getopts = new getopts ();
|
||||
$getopts = new Getopts ();
|
||||
$getopts->simulate ("sim\ ulate -h -d -d -f ii -o 1\ 2 -o \"2 2\" -o 3 -- -bla final");
|
||||
$getopts->add ("Help", "?h", array ("help","help2"), "Help of the software");
|
||||
$getopts->add ("Debug", "d", "debug", "Debug", "DebugLevel", 2);
|
||||
@@ -55,7 +57,7 @@ class getoptsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_getShort1 ()
|
||||
{
|
||||
// One unique value (-h -> true/false)
|
||||
$getopts = new getopts ();
|
||||
$getopts = new Getopts ();
|
||||
$getopts->simulate ("sim\ ulate -h -d -d ");
|
||||
$getopts->add ("Help", "?h", array ("help","help2"), "Help of the software");
|
||||
$getopts->add ("Debug", "d", "debug", "Debug", "DebugLevel", 2);
|
||||
@@ -66,7 +68,7 @@ class getoptsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_getShort2 ()
|
||||
{
|
||||
// Multiple values, two set (-d -d)
|
||||
$getopts = new getopts ();
|
||||
$getopts = new Getopts ();
|
||||
$getopts->simulate ("sim\ ulate -h -d -d ");
|
||||
$getopts->add ("Help", "?h", array ("help","help2"), "Help of the software");
|
||||
$getopts->add ("Debug", "d", "debug", "Debug", "DebugLevel", 2);
|
||||
@@ -77,7 +79,7 @@ class getoptsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_getShort3 ()
|
||||
{
|
||||
// Multiple values, one set (-d)
|
||||
$getopts = new getopts ();
|
||||
$getopts = new Getopts ();
|
||||
$getopts->simulate ("sim\ ulate -h -d ");
|
||||
$getopts->add ("Help", "?h", array ("help","help2"), "Help of the software");
|
||||
$getopts->add ("Debug", "d", "debug", "Debug", "DebugLevel", 2);
|
||||
@@ -88,7 +90,7 @@ class getoptsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_getShort4 ()
|
||||
{
|
||||
// Multiple values, None set (-d)
|
||||
$getopts = new getopts ();
|
||||
$getopts = new Getopts ();
|
||||
$getopts->simulate ("sim\ ulate -h ");
|
||||
$getopts->add ("Help", "?h", array ("help","help2"), "Help of the software");
|
||||
$getopts->add ("Debug", "d", "debug", "Debug", "DebugLevel", 2);
|
||||
@@ -99,7 +101,7 @@ class getoptsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_getLong1 ()
|
||||
{
|
||||
// One unique value (--help -> true/false)
|
||||
$getopts = new getopts ();
|
||||
$getopts = new Getopts ();
|
||||
$getopts->simulate ("sim\ ulate --help -d -d ");
|
||||
$getopts->add ("Help", "?h", array ("help","help2"), "Help of the software");
|
||||
$getopts->add ("Debug", "d", "debug", "Debug", "DebugLevel", 2);
|
||||
@@ -110,7 +112,7 @@ class getoptsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_getLong2 ()
|
||||
{
|
||||
// Multiple values, two set (-debug --debug)
|
||||
$getopts = new getopts ();
|
||||
$getopts = new Getopts ();
|
||||
$getopts->simulate ("sim\ ulate -h --debug --debug ");
|
||||
$getopts->add ("Help", "?h", array ("help","help2"), "Help of the software");
|
||||
$getopts->add ("Debug", "d", "debug", "Debug", "DebugLevel", 2);
|
||||
@@ -121,7 +123,7 @@ class getoptsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_getLong3 ()
|
||||
{
|
||||
// Multiple values, one set (-d)
|
||||
$getopts = new getopts ();
|
||||
$getopts = new Getopts ();
|
||||
$getopts->simulate ("sim\ ulate --help -d ");
|
||||
$getopts->add ("Help", "?h", array ("help","help2"), "Help of the software");
|
||||
$getopts->add ("Debug", "d", "debug", "Debug", "DebugLevel", 2);
|
||||
@@ -132,7 +134,7 @@ class getoptsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_getLong4 ()
|
||||
{
|
||||
// Multiple values, None set (-d)
|
||||
$getopts = new getopts ();
|
||||
$getopts = new Getopts ();
|
||||
$getopts->simulate ("sim\ ulate -h");
|
||||
$getopts->add ("Help", "?h", array ("help","help2"), "Help of the software");
|
||||
$getopts->add ("Debug", "d", "debug", "Debug", "DebugLevel", 2);
|
||||
@@ -142,7 +144,7 @@ class getoptsTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_restOfLine1 ()
|
||||
{
|
||||
$getopts = new getopts ();
|
||||
$getopts = new Getopts ();
|
||||
$getopts->simulate ("sim\ ulate -h -d -d -- -bla final");
|
||||
$getopts->add ("Help", "?h", array ("help","help2"), "Help of the software");
|
||||
$getopts->add ("Debug", "d", "debug", "Debug", "DebugLevel", 2);
|
||||
@@ -152,7 +154,7 @@ class getoptsTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_restOfLine2 ()
|
||||
{
|
||||
$getopts = new getopts ();
|
||||
$getopts = new Getopts ();
|
||||
$getopts->simulate ("sim\ ulate bla final");
|
||||
$getopts->add ("Help", "?h", array ("help","help2"), "Help of the software");
|
||||
$getopts->add ("Debug", "d", "debug", "Debug", "DebugLevel", 2);
|
||||
@@ -162,7 +164,7 @@ class getoptsTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_restOfLine3 ()
|
||||
{
|
||||
$getopts = new getopts ();
|
||||
$getopts = new Getopts ();
|
||||
$getopts->simulate ("sim\ ulate -- -bla final");
|
||||
$getopts->add ("Help", "?h", array ("help","help2"), "Help of the software");
|
||||
$getopts->add ("Debug", "d", "debug", "Debug", "DebugLevel", 2);
|
||||
@@ -172,7 +174,7 @@ class getoptsTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_programName1 ()
|
||||
{
|
||||
$getopts = new getopts ();
|
||||
$getopts = new Getopts ();
|
||||
$getopts->simulate ("sim\ ulate -h -d -d -- -bla final");
|
||||
$getopts->add ("Help", "?h", array ("help","help2"), "Help of the software");
|
||||
$getopts->add ("Debug", "d", "debug", "Debug", "DebugLevel", 2);
|
||||
|
||||
Reference in New Issue
Block a user