From 1713d322a309d9cf405cfe83e2131368f29b222b Mon Sep 17 00:00:00 2001 From: dchill42 Date: Sat, 24 Nov 2012 20:23:21 -0500 Subject: Replaced Mock_Core_Lang with PHPUnit mockups Signed-off-by: dchill42 --- tests/codeigniter/helpers/language_helper_test.php | 4 +++- tests/codeigniter/libraries/Calendar_test.php | 13 +++++------ tests/codeigniter/libraries/Upload_test.php | 3 ++- tests/mocks/core/lang.php | 15 ------------- tests/mocks/libraries/calendar.php | 25 ---------------------- 5 files changed, 10 insertions(+), 50 deletions(-) delete mode 100644 tests/mocks/core/lang.php delete mode 100644 tests/mocks/libraries/calendar.php (limited to 'tests') diff --git a/tests/codeigniter/helpers/language_helper_test.php b/tests/codeigniter/helpers/language_helper_test.php index 06932b9fd..1fe0ef17b 100644 --- a/tests/codeigniter/helpers/language_helper_test.php +++ b/tests/codeigniter/helpers/language_helper_test.php @@ -5,7 +5,9 @@ class Language_helper_test extends CI_TestCase { public function test_lang() { $this->helper('language'); - $this->ci_instance_var('lang', new Mock_Core_Lang()); + $lang = $this->getMock('CI_Lang', array('line')); + $lang->expects($this->any())->method('line')->will($this->returnValue(FALSE)); + $this->ci_instance_var('lang', $lang); $this->assertFalse(lang(1)); $this->assertEquals('', lang(1, 'foo')); diff --git a/tests/codeigniter/libraries/Calendar_test.php b/tests/codeigniter/libraries/Calendar_test.php index 95668d70d..952e8a8d2 100644 --- a/tests/codeigniter/libraries/Calendar_test.php +++ b/tests/codeigniter/libraries/Calendar_test.php @@ -2,12 +2,12 @@ class Calendar_test extends CI_TestCase { - function __construct() + function set_up() { - $obj = new stdClass; - $obj->calendar = new Mock_Libraries_Calendar(); - - $this->calendar = $obj->calendar; + $lang = $this->getMock('CI_Lang', array('load', 'line')); + $lang->expects($this->any())->method('line')->will($this->returnValue(FALSE)); + $this->ci_instance_var('lang', $lang); + $this->calendar = new CI_Calendar(); } function test_initialize() @@ -20,9 +20,6 @@ class Calendar_test extends CI_TestCase { $this->assertEquals('monday', $this->calendar->start_day); } - /** - * @covers Mock_Libraries_Calendar::parse_template - */ function test_generate() { $no_events = ' diff --git a/tests/codeigniter/libraries/Upload_test.php b/tests/codeigniter/libraries/Upload_test.php index 546cebc59..1bd8f1430 100644 --- a/tests/codeigniter/libraries/Upload_test.php +++ b/tests/codeigniter/libraries/Upload_test.php @@ -7,7 +7,8 @@ class Upload_test extends CI_TestCase { $ci = $this->ci_instance(); $ci->upload = new Mock_Libraries_Upload(); $ci->security = new Mock_Core_Security(); - $ci->lang = new Mock_Core_Lang(); + $ci->lang = $this->getMock('CI_Lang', array('load', 'line')); + $ci->lang->expects($this->any())->method('line')->will($this->returnValue(FALSE)); $this->upload = $ci->upload; } diff --git a/tests/mocks/core/lang.php b/tests/mocks/core/lang.php deleted file mode 100644 index 27ea3faba..000000000 --- a/tests/mocks/core/lang.php +++ /dev/null @@ -1,15 +0,0 @@ -CI = new stdClass; - $this->CI->lang = new Mock_Core_Lang(); - - if ( ! in_array('calendar_lang.php', $this->CI->lang->is_loaded, TRUE)) - { - $this->CI->lang->load('calendar'); - } - - $this->local_time = time(); - - if (count($config) > 0) - { - $this->initialize($config); - } - - log_message('debug', 'Calendar Class Initialized'); - } - -} \ No newline at end of file -- cgit v1.2.3-24-g4f1b