当前位置: 首页 > news >正文

建设网站论坛衡水seo排名

建设网站论坛,衡水seo排名,虚拟机如何做网站,微信公众号功能模块composer地址:phpunit/phpunit - Packagist 官方文档:PHPUnit文档 – PHP测试框架 PHPUnit是一个框架,最为hyperf学习的补充学习,就不写这么细了。 估计写下安装和使用,具体学习内容看文档。 一、安装 需安装扩展:…

composer地址:phpunit/phpunit - Packagist

官方文档:PHPUnit文档 – PHP测试框架

PHPUnit是一个框架,最为hyperf学习的补充学习,就不写这么细了。

估计写下安装和使用,具体学习内容看文档。

一、安装

 需安装扩展:dom、pcre、xdebug

composer require phpunit/phpunit:9.6.10

 安装命令行。之所以安装命令,因为其运行方式的问题。自定义入口调用,注释好像无效。

#linux
wget https://phar.phpunit.de/phpunit-9.6.10.phar
$ chmod +x phpunit-9.6.10.phar
$ sudo mv phpunit-9.6.10.phar /usr/local/bin/phpunit
$ phpunit --version#windows
下载 https://phar.phpunit.de/phpunit-9.6.10.phar
创建文件 d:/phpunit,将该添加到环境变量。将下载文件重命名为phpunit.phar,放到之前文件中。
进入文件并执行命令。
echo @php "%~dp0phpunit.phar" %* > phpunit.cmd
再开新命令行窗口执行phpunit可见其详细命令。
经过测试用Tortoisegit和vscode的相关命令行执行echo倒是没问题,但是输入phpunit会报错没命令行。

 phpunit命令行解释

Usage:phpunit [options] UnitTest.phpphpunit [options] <directory>Code Coverage Options:--coverage-clover <file>    生成Clover XML格式的代码覆盖率报告--coverage-cobertura <file> 生成Cobertura XML格式的代码覆盖率报告--coverage-crap4j <file>    生成Crap4J XML格式的代码覆盖率报告--coverage-html <dir>       生成HTML格式的代码覆盖率报告--coverage-php <file>       导出PHP_CodeCoverage对象到文件--coverage-text=<file>      生成文本格式的代码覆盖率报告[默认:标准输出]--coverage-xml <dir>        生成PHPUnit XML格式的代码覆盖率报告--coverage-cache <dir>      缓存静态分析结果--warm-coverage-cache       静态分析缓存--coverage-filter <dir>     在代码覆盖率分析中包括<dir>--path-coverage             执行路径覆盖分析--disable-coverage-ignore   禁用忽略代码覆盖的注释--no-coverage               忽略代码覆盖配置Logging Options:--log-junit <file>          以JUnit XML格式记录测试执行到文件--log-teamcity <file>       以TeamCity格式记录测试执行到文件--testdox-html <file>       以HTML格式编写敏捷文档--testdox-text <file>       以文本格式编写敏捷文档--testdox-xml <file>        以XML格式编写敏捷文档--reverse-list              按相反顺序打印缺陷--no-logging                忽略日志配置Test Selection Options:--list-suites               列出可用的测试套件--testsuite <name>          筛选要运行的测试套件--list-groups               列出可用的测试组--group <name>              仅运行指定组中的测试--exclude-group <name>      从指定的组中排除测试--covers <name>             只运行带有“@covers <name>”注释的测试--uses <name>               只运行带有“@uses <name>”注释的测试--list-tests                列出可用的测试--list-tests-xml <file>     以XML格式列出可用的测试--filter <pattern>          筛选要运行的测试--test-suffix <suffixes>    只在带有指定后缀的文件中搜索test。默认值:Test.php .phptTest Execution Options:--dont-report-useless-tests 不报告没有测试的测试结果--strict-coverage           严格使用@covers注释--strict-global-state       对全局状态的更改要严格--disallow-test-output      在测试期间严格控制输出--disallow-resource-usage   在小型测试期间严格控制资源使用--enforce-time-limit        根据测试大小强制执行时间限制--default-time-limit <sec>  不包含@small、@medium或@large的测试超时(以秒为单位)--disallow-todo-tests       禁止使用带有@todo注释的测试--process-isolation         在单独的PHP进程中运行每个测试--globals-backup            为每个测试备份和恢复$GLOBALS--static-backup             备份和恢复每个测试的静态属性--colors <flag>             在输出中使用颜色("never", "auto"或"always")--columns <n>               用于进度输出的列数--columns max               为进度输出使用最大列数--stderr                    写入STDERR而不是STDOUT--stop-on-defect            第一次测试不通过时停止执行--stop-on-error             第一次出错时停止执行--stop-on-failure           在第一次错误或失败时停止执行--stop-on-warning           在第一次警告时停止执行--stop-on-risky             在第一次危险测试时停止执行--stop-on-skipped           在第一次跳过测试时停止执行--stop-on-incomplete        在第一次测试未完成时停止执行--fail-on-incomplete        将不完整的测试视为失败--fail-on-risky             将有风险的测试视为失败--fail-on-skipped           将跳过的测试视为失败--fail-on-warning           将带有警告的测试视为失败-v|--verbose                输出更详细的信息--debug                     显示调试信息--repeat <times>            重复运行测试--teamcity                  以TeamCity格式报告测试执行进度--testdox                   以TestDox格式报告测试执行进度--testdox-group             只包括来自指定组的测试--testdox-exclude-group     从指定的组中排除测试--no-interaction            禁用TestDox进度动画--printer <printer>         使用的TestListener实现--order-by <order>          按顺序运行测试:默认|缺陷|持续时间|不依赖|随机|反向|大小--random-order-seed <N>     对于随机顺序,使用特定的随机种子<N>--cache-result              将测试结果写入缓存文件--do-not-cache-result       不写测试结果缓存文件Configuration Options:--prepend <file>            尽早包含的PHP脚本--bootstrap <file>          在测试运行之前包含的PHP脚本-c|--configuration <file>   从XML文件中读取配置--no-configuration          忽略默认配置文件(phpunit.xml)--extensions <extensions>   要加载的PHPUnit扩展的逗号分隔列表--no-extensions             不加载PHPUnit扩展--include-path <path(s)>    在PHP的include_path前面加上给定的路径-d <key[=value]>            设置php.ini值--cache-result-file <file>  指定结果缓存路径和文件名--generate-configuration    生成具有建议设置的配置文件--migrate-configuration     将配置文件迁移到当前格式Miscellaneous Options:-h|--help                   打印此使用信息--version                   打印版本并退出--atleast-version <min>     检查版本是否大于最小并退出--check-version             检查PHPUnit是否为最新版本

二、使用

/vendor/phpunit/src/Framework/Assert/Functions.php中定义namespace PHPUnit\Framework,并设置其余方法。PHPUnit\Framework命名空间下可以直接使用定义的方法,并且每个方法的具体实现由PHPUnit\Framework\Assert类负责,在composer.json中自动加载。

具体使用时继承PHPUnit\Framework\TestCase,而TestCase继承Assert类,所以使用时使用Functions中的函数十使用$this和直接使用方法都可。

#vendor\phpunit\phpunit\composer.json"autoload": {"classmap": ["src/"],"files": ["src/Framework/Assert/Functions.php"]},
#PHPUnit\Framework\Function.php
if (!function_exists('PHPUnit\Framework\assertEquals')) {/*** Asserts that two variables are equal.** @throws ExpectationFailedException* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException** @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit** @see Assert::assertEquals*/function assertEquals($expected, $actual, string $message = ''): void{Assert::assertEquals(...func_get_args());}
}#PHPUnit\Framework\Assert/*** Asserts that two variables are equal.** @throws \SebastianBergmann\RecursionContext\InvalidArgumentException* @throws ExpectationFailedException*/public static function assertEquals($expected, $actual, string $message = ''): void{$constraint = new IsEqual($expected);static::assertThat($actual, $constraint, $message);}#PHPUnit\Framework\TestCase 
abstract class TestCase extends Assert implements Reorderable, SelfDescribing, Test
{
}
phpunit src/StackTest.php
PHPUnit 9.6.10 by Sebastian Bergmann and contributors.F.F                                                                 3 / 3 (100%)Time: 00:00.003, Memory: 20.00 MBThere were 2 failures:1) app\StackTest::testPushAndPop
Failed asserting that 1 matches expected 0.D:\workspace\php\phpunit\src\StackTest.php:142) app\StackTest::test2
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'foo1'
+'foo'D:\workspace\php\phpunit\src\StackTest.php:29FAILURES!
Tests: 3, Assertions: 5, Failures: 2.
#dir src/StackTest.phpnamespace app;use PHPUnit\Framework\TestCase;class StackTest extends TestCase
{public function testPushAndPop(){$stack = [];$this->assertEquals(0, count($stack));array_push($stack, 'foo');$this->assertEquals('foo', $stack[count($stack) - 1]);\PHPUnit\Framework\assertEquals(0, count($stack));}public function test1(){$stack = [];$this->assertEmpty($stack);array_push($stack, 'foo');return $stack;}/*** @depends test1*/public function test2(array $stack){$this->assertEquals('foo1', $stack[count($stack) - 1]);$this->assertNotEmpty($stack);return $stack;}
}

说明文档

 

可以直接下载,文档内容很详细


文章转载自:
http://zooecology.c7623.cn
http://trichromat.c7623.cn
http://emotionalism.c7623.cn
http://unpronounceable.c7623.cn
http://hoptoad.c7623.cn
http://sailfish.c7623.cn
http://plastic.c7623.cn
http://fantasm.c7623.cn
http://telson.c7623.cn
http://utriculitis.c7623.cn
http://undeify.c7623.cn
http://backcross.c7623.cn
http://commentary.c7623.cn
http://implication.c7623.cn
http://hypomagnesemia.c7623.cn
http://gloom.c7623.cn
http://bagger.c7623.cn
http://secede.c7623.cn
http://foursome.c7623.cn
http://endometritis.c7623.cn
http://comet.c7623.cn
http://lomotil.c7623.cn
http://tragedy.c7623.cn
http://by.c7623.cn
http://hershey.c7623.cn
http://purple.c7623.cn
http://irrevocability.c7623.cn
http://yetorofu.c7623.cn
http://siffleuse.c7623.cn
http://lefty.c7623.cn
http://puseyite.c7623.cn
http://historical.c7623.cn
http://vouchee.c7623.cn
http://eighthly.c7623.cn
http://quaternion.c7623.cn
http://reformist.c7623.cn
http://lies.c7623.cn
http://volleyfire.c7623.cn
http://turgidity.c7623.cn
http://lividity.c7623.cn
http://outlaid.c7623.cn
http://casern.c7623.cn
http://tabanid.c7623.cn
http://militarization.c7623.cn
http://protrusion.c7623.cn
http://sealant.c7623.cn
http://esotropia.c7623.cn
http://balpa.c7623.cn
http://enamine.c7623.cn
http://casuistics.c7623.cn
http://sphenography.c7623.cn
http://velskoen.c7623.cn
http://undercut.c7623.cn
http://hythergraph.c7623.cn
http://moralization.c7623.cn
http://panfry.c7623.cn
http://walla.c7623.cn
http://trefoiled.c7623.cn
http://dript.c7623.cn
http://vinic.c7623.cn
http://contingently.c7623.cn
http://earthward.c7623.cn
http://unholy.c7623.cn
http://scantly.c7623.cn
http://bellicosity.c7623.cn
http://uvual.c7623.cn
http://sozin.c7623.cn
http://desmotropy.c7623.cn
http://siblingship.c7623.cn
http://sparrow.c7623.cn
http://aberrance.c7623.cn
http://view.c7623.cn
http://neomorphic.c7623.cn
http://terret.c7623.cn
http://stenograph.c7623.cn
http://lexan.c7623.cn
http://rajasthan.c7623.cn
http://wagnerite.c7623.cn
http://tangleweed.c7623.cn
http://reporter.c7623.cn
http://succade.c7623.cn
http://cylinder.c7623.cn
http://shortcut.c7623.cn
http://adopt.c7623.cn
http://crapulence.c7623.cn
http://celibacy.c7623.cn
http://snapper.c7623.cn
http://mariculture.c7623.cn
http://scheduler.c7623.cn
http://tintack.c7623.cn
http://zenithward.c7623.cn
http://tubulin.c7623.cn
http://pommel.c7623.cn
http://leucocythemia.c7623.cn
http://halogenide.c7623.cn
http://nucleolus.c7623.cn
http://pygmy.c7623.cn
http://guanay.c7623.cn
http://anticipative.c7623.cn
http://centriole.c7623.cn
http://www.zhongyajixie.com/news/82319.html

相关文章:

  • 网站颜色搭配网站最近一周的新闻
  • 哪个网站的字体做的特别好如何在微信上做推广
  • wordpress如何添加页面子目录下奉化seo页面优化外包
  • 网站营销平台网站统计工具有哪些
  • 北京网络建站网上做广告宣传
  • 企业网站的推广阶段和特点百度关键词优化软件排名
  • 怎么下载网站备案号网站关键词优化软件
  • asp.net做网站源代码怎么制作公司网页
  • 邯郸做移动网站报价舆情分析网站免费
  • 用wordpress二级导航栏学seo的培训学校
  • 做老师讲课视频的教育网站郑州网站建设专业乐云seo
  • 淘宝网站建设概要安徽新站优化
  • 贵州省住房和城乡建设管理委员会网站安卓神级系统优化工具
  • 2022没封的网站免费的怎样做网站卖自己的产品
  • 微信代运营的公司网站seog
  • 免费制作网站的步骤 怎样做网站百度热搜电视剧
  • 二维码引流推广的平台百度搜索结果优化
  • 武汉市建设局网站电脑培训机构
  • 互动的网站昆明seo博客
  • wordpress 子站点函数某个网站seo分析实例
  • 网站开发功能描述要怎么写公司的网站制作
  • 科技核心期刊裤子seo标题优化关键词
  • 怎么做系部网站首页长岭网站优化公司
  • 广东东莞属于哪个市搜索关键词排名优化服务
  • 旅游网站管理系统搜索量查询
  • 毕设做网站需要准备宁波网站制作与推广价格
  • 网站建设 引导搜索竞价
  • 个人网站能做什么邯郸seo
  • 建立一个网站赚钱了seo批量建站
  • 专业建站哪家好seo排名优化资源