本文整理汇总了PHP中teardown函数的典型用法代码示例。如果您正苦于以下问题:PHP teardown函数的具体用法?PHP teardown怎么用?PHP teardown使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了teardown函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDownAfterClass
public static function tearDownAfterClass()
{
if (defined('SKIPPING')) {
return;
}
teardown(self::$db, DB_WIPE_FILE);
}
示例2: tearDownAfterClass
public static function tearDownAfterClass()
{
if (defined('SKIPPING')) {
return;
}
self::$db->execute(fix_schema(file_get_contents(DB_ALTERNATE_SCHEMA_WIPE_FILE)));
teardown(self::$db, DB_WIPE_FILE);
}
示例3: tearDownAfterClass
public static function tearDownAfterClass()
{
if (defined('SKIPPING')) {
return;
}
teardown(self::$db, DB_EXTENDED_TEARDOWN_FILE);
teardown(self::$db, DB_TEARDOWN_FILE);
}
示例4: tearDownAfterClass
public static function tearDownAfterClass()
{
if (defined('SKIPPING')) {
return;
}
teardown(self::$db, DB_TEARDOWN_FILE);
self::$db->__destruct();
}
示例5: assert_equals
assert_equals(true, transient()->setup1);
});
// TODO this is terrible
should("count the number of tests", function () {
assert_equals(4, Smoothie::instance()->tests);
});
// TODO this is terrible
should("count the number of assertions", function () {
assert_equals(4, Smoothie::instance()->assertions);
});
context("nested in a context", function () {
setup(function () {
transient()->setup2 = true;
});
teardown(function () {
$GLOBALS['I_RAN_TEARDOWN'] = true;
});
should("have called its parent setup", function () {
assert_equals(true, transient()->setup1);
});
should("have called its own setup", function () {
assert_equals(true, transient()->setup2);
});
context("nested in a context", function () {
setup(function () {
transient()->setup3 = true;
});
should("have called all three setups", function () {
assert_equals(true, transient()->setup1);
assert_equals(true, transient()->setup2);
assert_equals(true, transient()->setup3);
示例6: write_xml
/**
* Write XML data to a file.
* @param string $contents
* @param string $xml_path where we write this
*/
function write_xml($contents, $xml_path)
{
if ($fh = @fopen($xml_path, 'w')) {
fwrite($fh, $contents);
fclose($fh);
print 'config.xml file written at ' . $xml_path . PHP_EOL;
} else {
print 'There was a problem opening ' . $xml_path . ' for writing.' . PHP_EOL;
print 'You can paste the following contents into ' . $xml_path . PHP_EOL;
print 'and then run: php ./index.php --installmode=new' . PHP_EOL;
print 'or navigate to your site via a browser and do a normal installation.' . PHP_EOL . PHP_EOL;
print $contents;
print PHP_EOL . PHP_EOL;
teardown();
}
}
示例7: suite
<?php
/*
* How to use teardown
*/
namespace Preview\DSL\TDD;
require_once __DIR__ . '/../ok.php';
suite("teardown", function () {
teardown(function () {
$this->usage = "run teardown each test case";
});
teardown(function () {
$this->note = "teardown hooks are run in order";
});
});