Skip to content

Commit

Permalink
Merge pull request bcit-ci#2030 from dchill42/unit_tests
Browse files Browse the repository at this point in the history
Replaced Mock_Core_Lang with PHPUnit mockups
  • Loading branch information
narfbg committed Nov 25, 2012
2 parents ad5f1d0 + 1713d32 commit ade05b4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 50 deletions.
4 changes: 3 additions & 1 deletion tests/codeigniter/helpers/language_helper_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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('<label for="foo"></label>', lang(1, 'foo'));
Expand Down
13 changes: 5 additions & 8 deletions tests/codeigniter/libraries/Calendar_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -20,9 +20,6 @@ function test_initialize()
$this->assertEquals('monday', $this->calendar->start_day);
}

/**
* @covers Mock_Libraries_Calendar::parse_template
*/
function test_generate()
{
$no_events = '<table border="0" cellpadding="4" cellspacing="0">
Expand Down
3 changes: 2 additions & 1 deletion tests/codeigniter/libraries/Upload_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ function set_up()
$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;
}

Expand Down
15 changes: 0 additions & 15 deletions tests/mocks/core/lang.php

This file was deleted.

25 changes: 0 additions & 25 deletions tests/mocks/libraries/calendar.php

This file was deleted.

0 comments on commit ade05b4

Please sign in to comment.