gpt4 book ai didi

php - PHP 测试套件

转载 作者:行者123 更新时间:2023-11-28 20:03:02 24 4
gpt4 key购买 nike

有没有好的开源 php 测试套件?到目前为止我只找到了http://www.lastcraft.com/simple_test.php但我找不到很多关于这个项目的评论。任何人都可以建议我一些好的 php 测试套件吗?

最佳答案

事实上的标准是:

  • PHPUnit – 通常用于测试 OOP 驱动的应用程序。
  • phpt – 由 PHP 项目使用。

这是一个使用 PHPUnit 的测试用例示例(来自手册):

class StackTest extends PHPUnit_Framework_TestCase
{
public function testPushAndPop()
{
$stack = array();
$this->assertEquals(0, count($stack));

array_push($stack, 'foo');
$this->assertEquals('foo', $stack[count($stack)-1]);
$this->assertEquals(1, count($stack));

$this->assertEquals('foo', array_pop($stack));
$this->assertEquals(0, count($stack));
}
}

这是用 phpt 进行的测试:

--TEST--URL stat PHP_STREAM_URL_STAT_QUIET does not leak memory--SKIPIF--<?php if(!extension_loaded("rar")) print "skip"; ?>--FILE--<?php$file = "rar://" .    dirname(__FILE__) . '/dirlink_unix.rar' .    "#non_existant_file";var_dump(is_dir($file));echo "Done.\n";--EXPECTF--bool(false)Done.

关于php - PHP 测试套件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3336769/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com