Permalink
Browse files

adding unit tests

  • Loading branch information...
1 parent 10e6818 commit f7637dbd3d38597867b5e04414e9e102dfffa02a @dongilbert dongilbert committed Oct 9, 2012
Showing with 21 additions and 4 deletions.
  1. +21 −4 tests/suites/legacy/model/JModelLegacyTest.php
@@ -7,11 +7,19 @@
* @license GNU General Public License version 2 or later; see LICENSE
*/
+class TestModelLead extends JModelLegacy
+{
+}
+
+class RemodelModelRoom extends JModelLegacy
+{
+}
+
/**
* Test class for JModelLegacy.
*/
-class JModelLegacyTest extends PHPUnit_Framework_TestCase
-{
+class JModelLegacyTest extends TestCase
+{
/**
* @todo Implement testGetInstance().
*/
@@ -62,8 +70,17 @@ public function testSetDbo()
*/
public function testGetName()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete('This test has not been implemented yet.');
+ $class = JModelLegacy::getInstance('Lead', 'TestModel');
+ $this->assertEquals('lead', $class->getName());
+ $this->assertEquals('com_test', TestReflection::getValue($class, 'option'));
+
+ $class = JModelLegacy::getInstance('Room', 'RemodelModel');
+ $this->assertEquals('room', $class->getName());
+ $this->assertEquals('com_remodel', TestReflection::getValue($class, 'option'));
+
+ TestReflection::setValue($class, 'name', 'foo');
+ $this->assertEquals('foo', $class->getName());
+ $this->assertEquals('com_remodel', TestReflection::getValue($class, 'option'));
}
/**

0 comments on commit f7637db

Please sign in to comment.