Skip to content

Instantly share code, notes, and snippets.

@jlamim
Last active August 30, 2016 01:09
Show Gist options
  • Save jlamim/3a3c2cedd53d4d1ddf083a68aaa7321e to your computer and use it in GitHub Desktop.
Save jlamim/3a3c2cedd53d4d1ddf083a68aaa7321e to your computer and use it in GitHub Desktop.
Testes unitários nativos no CodeIgniter
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Testes extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->library('unit_test');
}
public function UmMaisUm()
{
$test = 1 + 1;
$expected_result = 2;
$test_name = 'Um mais um';
$str_template = 'ITEM | DESCRIÇÃO'.PHP_EOL.'{rows}{item} | {result}'.PHP_EOL.'{/rows}';
$this->unit->set_template($str_template);
echo $this->unit->run($test, $expected_result, $test_name);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment