Вопрос

file1:

<?php
require_once('simpletest/autorun.php');
require_once('simpletest/web_tester.php');

class TestOfRankings extends WebTestCase {
    function tesetWeAreTopOfGoogle() {
        $this->get('http://poll:8888/index.php/admin/unit_test');
        $this->assertText('this is good');
    }
}
?>

file2:

require_once('simpletest/autorun.php');
require_once('simpletest/web_tester.php');

class MakTest extends WebTestCase {
    function testOneAndOneMakesTwo() {
        $this->get('http://poll:8888/index.php/admin/unit_test');
        $this->assertText('this is good');
    }
}

almost identical files, why do they give me different result?

file1.php
OK
Test cases run: 0/2, Passes: 0, Failures: 0, Exceptions: 0


file2.php
OK
Test cases run: 1/2, Passes: 1, Failures: 0, Exceptions: 0
Это было полезно?

Решение

According to the SimpleTest docs:

When a test case runs, it will search for any method that starts with the string "test" and execute that method. If the method starts "test", it's a test.

In file1 the function name is tesetWeAreTopOfGoogle (this seems to be a typo). Switch to testWeAreTopOfGoogle and you'll be golden.

Другие советы

Your functions probably need to start with test. tesetWeAreTopOfGoogle should be testWeAreTopOfGoogle?

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top