From f30b14ae7bb45948f0b8f6dc806dc6c59800fe56 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 20 Feb 2014 16:18:37 +0200 Subject: Fix CI_Calendar tests --- tests/codeigniter/libraries/Calendar_test.php | 32 +++++++++++++++++++------ tests/codeigniter/libraries/Encryption_test.php | 2 ++ 2 files changed, 27 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/codeigniter/libraries/Calendar_test.php b/tests/codeigniter/libraries/Calendar_test.php index 768bc8573..54879fec9 100644 --- a/tests/codeigniter/libraries/Calendar_test.php +++ b/tests/codeigniter/libraries/Calendar_test.php @@ -2,15 +2,21 @@ class Calendar_test extends CI_TestCase { - function set_up() + public function set_up() { + // Required for get_total_days() + $this->ci_instance_var('load', $this->getMock('CI_Loader', array('helper'))); + $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() + // -------------------------------------------------------------------- + + public function test_initialize() { $this->calendar->initialize(array( 'month_type' => 'short', @@ -20,7 +26,9 @@ class Calendar_test extends CI_TestCase { $this->assertEquals('monday', $this->calendar->start_day); } - function test_generate() + // -------------------------------------------------------------------- + + public function test_generate() { $no_events = ' @@ -100,7 +108,9 @@ class Calendar_test extends CI_TestCase { $this->assertEquals($events, $this->calendar->generate(2011, 9, $data)); } - function test_get_month_name() + // -------------------------------------------------------------------- + + public function test_get_month_name() { $this->calendar->month_type = NULL; $this->assertEquals('January', $this->calendar->get_month_name('01')); @@ -109,7 +119,9 @@ class Calendar_test extends CI_TestCase { $this->assertEquals('Jan', $this->calendar->get_month_name('01')); } - function test_get_day_names() + // -------------------------------------------------------------------- + + public function test_get_day_names() { $this->assertEquals(array( 'Sunday', @@ -144,13 +156,17 @@ class Calendar_test extends CI_TestCase { ), $this->calendar->get_day_names()); } - function test_adjust_date() + // -------------------------------------------------------------------- + + public function test_adjust_date() { $this->assertEquals(array('month' => 8, 'year' => 2012), $this->calendar->adjust_date(8, 2012)); $this->assertEquals(array('month' => 1, 'year' => 2013), $this->calendar->adjust_date(13, 2012)); } - function test_get_total_days() + // -------------------------------------------------------------------- + + public function test_get_total_days() { $this->assertEquals(0, $this->calendar->get_total_days(13, 2012)); @@ -169,6 +185,8 @@ class Calendar_test extends CI_TestCase { $this->assertEquals(31, $this->calendar->get_total_days(12, 2012)); } + // -------------------------------------------------------------------- + public function test_default_template() { $array = array( diff --git a/tests/codeigniter/libraries/Encryption_test.php b/tests/codeigniter/libraries/Encryption_test.php index a8b5bc81e..5f2382482 100644 --- a/tests/codeigniter/libraries/Encryption_test.php +++ b/tests/codeigniter/libraries/Encryption_test.php @@ -7,6 +7,8 @@ class Encryption_test extends CI_TestCase { $this->encryption = new Mock_Libraries_Encryption(); } + // -------------------------------------------------------------------- + /** * __construct test * -- cgit v1.2.3-24-g4f1b