2012-01-17 11:55:42 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test class for /src/sys/common.php
|
|
|
|
*/
|
|
|
|
class commonTest extends UnitTestCase {
|
|
|
|
|
2012-07-12 10:23:55 -04:00
|
|
|
public function __construct()
|
2012-01-17 11:55:42 -05:00
|
|
|
{
|
|
|
|
parent::__construct('Common.php Tests');
|
|
|
|
}
|
2012-07-12 10:23:55 -04:00
|
|
|
|
|
|
|
public function setUp()
|
2012-01-17 11:55:42 -05:00
|
|
|
{
|
|
|
|
$this->empty = array();
|
2012-07-03 13:33:36 -04:00
|
|
|
$this->object = new stdClass();
|
|
|
|
$this->array_like = new stdClass(array('foo' => 'bar'));
|
2012-01-17 11:55:42 -05:00
|
|
|
}
|
2012-07-12 10:23:55 -04:00
|
|
|
|
|
|
|
public function tearDown()
|
2012-01-17 11:55:42 -05:00
|
|
|
{
|
|
|
|
unset($this->empty);
|
|
|
|
unset($this->object);
|
|
|
|
unset($this->array_like);
|
|
|
|
}
|
2012-07-12 10:23:55 -04:00
|
|
|
|
|
|
|
public function testEmptyArrayNotLikeArray()
|
2012-01-17 11:55:42 -05:00
|
|
|
{
|
|
|
|
// Empty is not array like
|
2012-05-22 11:11:36 -04:00
|
|
|
$this->assertFalse(miniMVC\is_like_array($this->empty));
|
2012-01-17 11:55:42 -05:00
|
|
|
}
|
2012-07-12 10:23:55 -04:00
|
|
|
|
|
|
|
public function testEmptyObjectIsLikeArray()
|
2012-01-17 11:55:42 -05:00
|
|
|
{
|
|
|
|
// Empty object is array like - because objects are truthy
|
2012-05-22 11:11:36 -04:00
|
|
|
$this->assertTrue(miniMVC\is_like_array($this->object));
|
2012-01-17 11:55:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|