diff options
author | Taufan Aditya <toopay@taufanaditya.com> | 2012-03-28 11:35:48 +0200 |
---|---|---|
committer | Taufan Aditya <toopay@taufanaditya.com> | 2012-03-28 11:35:48 +0200 |
commit | 30b34d099e4e9bcdc79ec496fdb89904444eaa4f (patch) | |
tree | ad384ceb38c490edfbee98d6488ca72d0c173f37 /tests/codeigniter/libraries/Table_test.php | |
parent | d44d720ba8b17fa58cb041111dca9c440f823446 (diff) |
Implementation of Mock class, remove ugly reflection class
Diffstat (limited to 'tests/codeigniter/libraries/Table_test.php')
-rw-r--r-- | tests/codeigniter/libraries/Table_test.php | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/tests/codeigniter/libraries/Table_test.php b/tests/codeigniter/libraries/Table_test.php index 04396d5fe..13f338c6b 100644 --- a/tests/codeigniter/libraries/Table_test.php +++ b/tests/codeigniter/libraries/Table_test.php @@ -100,42 +100,18 @@ class Table_test extends CI_TestCase { array('data' => 'size') ); - // test what would be discreet args, - // basically means a single array as the calling method - // will use func_get_args() - - $reflectionOfTable = new ReflectionClass($this->table); - $method = $reflectionOfTable->getMethod('_prep_args'); - - $method->setAccessible(true); - - $this->assertEquals( - $expected, - $method->invokeArgs( - $this->table, array(array('name', 'color', 'size'), 'discreet') - ) - ); - - // test what would be a single array argument. Again, nested - // due to func_get_args on calling methods $this->assertEquals( $expected, - $method->invokeArgs( - $this->table, array(array('name', 'color', 'size'), 'array') - ) + $this->table->prep_args(array('name', 'color', 'size')) ); - - + // with cell attributes - // need to add that new argument row to our expected outcome $expected[] = array('data' => 'weight', 'class' => 'awesome'); $this->assertEquals( $expected, - $method->invokeArgs( - $this->table, array(array('name', 'color', 'size', array('data' => 'weight', 'class' => 'awesome')), 'attributes') - ) + $this->table->prep_args(array('name', 'color', 'size', array('data' => 'weight', 'class' => 'awesome'))) ); } @@ -236,11 +212,6 @@ class Table_test extends CI_TestCase { public function test_set_from_array() { - $reflectionOfTable = new ReflectionClass($this->table); - $method = $reflectionOfTable->getMethod('_set_from_array'); - - $method->setAccessible(true); - $this->assertFalse($this->table->set_from_array('bogus')); $this->assertFalse($this->table->set_from_array(NULL)); |