summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-02-20 15:18:37 +0100
committerAndrey Andreev <narf@devilix.net>2014-02-20 15:18:37 +0100
commitf30b14ae7bb45948f0b8f6dc806dc6c59800fe56 (patch)
tree789b300b197d3c55fb8e62b14afb617002290f4e
parent083a22635140cb627cae7e4edf5d7127220c018e (diff)
Fix CI_Calendar tests
-rw-r--r--tests/codeigniter/libraries/Calendar_test.php32
-rw-r--r--tests/codeigniter/libraries/Encryption_test.php2
2 files changed, 27 insertions, 7 deletions
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 = '<table border="0" cellpadding="4" cellspacing="0">
@@ -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
*