Есть ли хороший учебник по использованию TortoiseGit с рабочими процессами? [закрыто]

Это мой тестовый файл phpunit

<?php // DemoTest - test to prove the point

function __autoload($className) {
    //  pick file up from current directory
    $f = $className.'.php'; 
    require_once $f;
}

class DemoTest extends PHPUnit_Framework_TestCase {
    // call same test twice - det different results 
    function test01() {
        $this->controller = new demo();
        ob_start();
        $this->controller->handleit();
        $result = ob_get_clean();  
        $expect = 'Actions is an array';
        $this->assertEquals($expect,$result);
    }

    function test02() {
        $this->test01();
    }
}
?>

Это тестируемый файл

<?php // demo.php
global $actions;
$actions=array('one','two','three');
class demo {
    function handleit() {
        global $actions;
        if (is_null($actions)) {
            print "Actions is null";
        } else {
            print('Actions is an array');
        }
    }
}
?>

В результате второй тест не проходит, потому что $ actions имеет значение null.

У меня вопрос - почему я не получаю одинаковые результаты по двум тестам?

Это ошибка в phpunit или это мое понимание php?

5
задан hakre 24 December 2012 в 21:56
поделиться