Skip to content

Commit

Permalink
More/fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Nov 6, 2013
1 parent ee672a8 commit 4ad819e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion framework/Pack/test/Horde/Pack/AutodetermineTest.php
Expand Up @@ -43,7 +43,7 @@ public function setUp()
public function testNegativeResults()
{
foreach ($this->types as $val) {
$this->_runTest(1, false);
$this->_runTest($val, false);
}

$this->_runTest($this->types, false);
Expand Down
25 changes: 22 additions & 3 deletions framework/Pack/test/Horde/Pack/Driver/TestBase.php
Expand Up @@ -26,12 +26,14 @@
abstract class Horde_Pack_Driver_TestBase extends Horde_Test_Case
{
static protected $pack;
static protected $sampleob;

protected $drivername;

static public function setUpBeforeClass()
{
self::$pack = new Horde_Pack();
self::$sampleob = new Horde_Pack_Autodetermine(true);
}

protected function setUp()
Expand All @@ -56,11 +58,13 @@ public function testNullWithCompression()
public function testBoolean()
{
$this->_runTest(true);
$this->_runTest(false);
}

public function testBooleanWithCompression()
{
$this->_runTest(true, true);
$this->_runTest(false, true);
}

public function testString()
Expand All @@ -75,12 +79,14 @@ public function testStringWithCompression()

public function testSimpleArray()
{
$this->_runTest(array());
$this->_runTest(range(1, 1000));
}

public function testSimpleArrayWithCompression()
{
$this->_runTest(range(1, 1000));
$this->_runTest(array(), true);
$this->_runTest(range(1, 1000), true);
}

public function testNestedArray()
Expand Down Expand Up @@ -108,14 +114,27 @@ public function testObject()
$ob->foo2 = array(1, 2, 3);
$ob->foo3 = 4;
$ob->foo4 = true;
$ob->foo5 = null;
$this->_runTest($ob);
}

public function testObjectWithCompression()
{
$ob = new stdClass;
$ob->foo = 'bar';
$ob->foo2 = array(1, 2, 3);
$ob->foo3 = 4;
$ob->foo4 = true;
$ob->foo5 = null;
$this->_runTest($ob);
}

public function testPhpObject()
{
/* Not all backends support. */
$driver = new $this->drivername();
if ($driver->phpob) {
$this->_runTest(self::$pack);
$this->_runTest(self::$sampleob);
}
}

Expand All @@ -124,7 +143,7 @@ public function testPhpObjectWithCompression()
/* Not all backends support. */
$driver = new $this->drivername();
if ($driver->phpob) {
$this->_runTest(self::$pack, true);
$this->_runTest(self::$sampleob, true);
}
}

Expand Down

0 comments on commit 4ad819e

Please sign in to comment.