Skip to content

Instantly share code, notes, and snippets.

@slav123
Created March 27, 2015 05:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slav123/f4014b4f3a6366de19eb to your computer and use it in GitHub Desktop.
Save slav123/f4014b4f3a6366de19eb to your computer and use it in GitHub Desktop.
Unit testing sample with CI 3
<?php
class CITest extends PHPUnit_Framework_TestCase
{
private $CI;
public function setUp()
{
// Load CI instance normally
$this->CI = &get_instance();
}
public function testGetPost()
{
$_SERVER['REQUEST_METHOD'] = 'GET';
$_GET['foo'] = 'bar';
$this->assertEquals('bar', $this->CI->input->get_post('foo'));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment