当前位置: 首页>>代码示例>>PHP>>正文


PHP SimpleTest::addTestCase方法代码示例

本文整理汇总了PHP中SimpleTest::addTestCase方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleTest::addTestCase方法的具体用法?PHP SimpleTest::addTestCase怎么用?PHP SimpleTest::addTestCase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimpleTest的用法示例。


在下文中一共展示了SimpleTest::addTestCase方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSpecificSequence

    }
    function testSpecificSequence()
    {
        $mock =& new MockDummy($this);
        $mock->setExpectedArgumentsSequence(1, "aMethod", array(1, 2, 3));
        $mock->setExpectedArgumentsSequence(2, "aMethod", array("Hello"));
        $mock->aMethod();
        $mock->aMethod(1, 2, 3);
        $mock->aMethod("Hello");
        $mock->aMethod();
    }
    function testFailedSequence()
    {
        $test =& new MockTestCase($this);
        $test->setExpectedArguments("assertTrue", array(false, "*"));
        $mock =& new MockDummy($test);
        $mock->setExpectedArgumentsSequence(0, "aMethod", array(1, 2, 3));
        $mock->setExpectedArgumentsSequence(1, "aMethod", array("Hello"));
        $mock->aMethod(1, 2);
        $mock->aMethod("Goodbye");
    }
}
$test = new SimpleTest("Mock components test");
$test->addTestCase(new TestOfParameterList());
$test->addTestCase(new TestOfCallMap());
$test->addTestCase(new TestOfCodeGeneration());
$test->addTestCase(new TestOfMockReturns());
$test->addTestCase(new TestOfMockTally());
$test->addTestCase(new TestOfMockExpectations());
$test->attachObserver(new TestHtmlDisplay());
$test->run();
开发者ID:sebs,项目名称:simpletest,代码行数:31,代码来源:simple_mock_test.php

示例2: testOfReference

        $b = $a;
        $this->assertIdentical($a, $b);
        $a = "0";
        $b = 0;
        $this->assertIdentical($a, $b);
        // Fail.
    }
    function testOfReference()
    {
        $a = "fred";
        $b =& $a;
        $this->assertReference($a, $b);
        $c = "Hello";
        $this->assertReference($a, $c);
        // Fail.
    }
    function testOfPatterns()
    {
        $this->assertWantedPattern("Hello there", '/hello/i');
        $this->assertNoUnwantedPattern("Hello there", '/hello/');
        $this->assertWantedPattern("Hello there", '/hello/');
        // Fail.
        $this->assertNoUnwantedPattern("Hello there", '/hello/i');
        // Fail.
    }
}
$test = new SimpleTest("Unit test case test, 8 fails and 8 passes");
$display = new TestHTMLDisplay();
$test->attachObserver($display);
$test->addTestCase(new TestOfUnitTestCase());
$test->run();
开发者ID:sebs,项目名称:simpletest,代码行数:31,代码来源:simple_unit_test.php


注:本文中的SimpleTest::addTestCase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。