CodeIgniter and SimpleTest - How to make your first test?

I am using web development using LAMP, PHP5, MySQL and NetBeans with Xdebug.

Now I want to improve my development by learning to use (A) proper testing and (B) structure. So I set up CodeIgniter, SimpleTest and a simple Xdebug add-in for Firefox. This is great because maroonbytes provided me with clear instructions and a customized setup ready for download. I stand on the shoulders of giants and am very grateful.

I have used SimpleTest in the past. Here is what I wrote:

<?php
require_once('../simpletest/unit_tester.php');
require_once('../simpletest/reporter.php');

class TestOfMysqlTransaction extends UnitTestCase {
  function testDB_ViewTable() {
    $this->assertEqual(1,1);   // a pseudo-test
  }
}
$test = new TestOfMysqlTransaction();
$test->run(new HtmlReporter())
?>

, , , . , . maroonbytes, Google , , . ?

+3
2

-, . , welcome.php, welcome_controller_test.php //. . .

-, Xdebug GET . . , .

-, , , :

//require_once('../simpletest/unit_tester.php');
//require_once('../simpletest/reporter.php');
...
//$test = new TestOfMysqlTransaction();
//$test->run(new HtmlReporter())

. CodeIgniter , TDD . TDD , PHP- , ( VBA!).

+1

Edit:

maroonbytes, :

  • SimpleTest @codeigniter.
  • / , .
  • "", "", "", "" "" .

, .php UnitTestCase , .:)

+2

Source: https://habr.com/ru/post/1745682/


All Articles