问题标签 [phpspec]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
8 回答
1214 浏览

php - PHPSpec - 无法运行,有人使用它进行 php 开发吗?

在stackoverflow上搜索了这个并没有找到答案

来自 Ruby On Rails 和 Rspec,我需要像 rspec(更轻松的转换)这样的工具。通过 PEAR 安装它并尝试运行它,但它不工作(还)

只是想问一下是否有人在使用它有同样的问题,因为它根本没有运行

尝试使用手册中的示例运行它 - http://dev.phpspec.org/manual/en/before.writing.code.specify.its.required.behaviour.html

什么都不返回

甚至跑步

什么都不返回

0 投票
1 回答
314 浏览

php - PHPSpec 库中的编码标准和设计模式

我真的很喜欢 PHPSpec 的代码库。

你们中的任何人都可以提到这个库中突出的任何标准和/或设计模式,因为这就是我希望我的代码的样子吗?

0 投票
1 回答
1093 浏览

php - 如何在 PHPSpec 中使用 ThrowException 匹配器?

我在使用 ExceptionMatcher 时遇到问题...我的示例规范:

我的示例类

有人成功使用了这个匹配器吗?

0 投票
3 回答
4120 浏览

php - PHPSpec 和覆盖率报告

有谁知道从 PHPSpec 测试生成覆盖率报告的方法?

我考虑过 xdebug,但据我所知,它无法为 jenkins 生成报告。

0 投票
2 回答
1782 浏览

php - 安装 phpspec

我确定我错过了一些明显的东西。但我在安装和使用 phpspec 时遇到问题。首先我不知道我应该使用 phpspec 还是 phpspec2。

我尝试过这样安装:- PEAR(不起作用)- git hub(克隆并且可以下载)- composer(似乎我只能安装依赖项)

如果有人知道“傻瓜指南的phpspec”,我将不胜感激。

还是使用 PHPUnit 更好?

0 投票
2 回答
412 浏览

php - 使用 PHPSpec2 测试 Paris 模型

我有一个巴黎模特,像这样:

我想用PHPSpec2来指定这个,但我遇到了一些问题。我想做类似的事情:

但是我如何访问我的规范中的 authenticate() 方法?我认为答案可能很简单,但我真的无法理解它......

0 投票
1 回答
570 浏览

php - 将 Codeigniter 2 与 phpspec2 集成

我想将 phpspec2 与 CodeIgniter 2 集成。我已经使用 composer 成功安装了 phpspec,如phpspec website中所述。现在我想将它集成到我的 CodeIgniter 2 安装中。我找到了AniDear关于这个主题的一篇文章,并按照描述做了所有事情。但是,当我运行时bin/phpspec出现错误:

等等。我的文件结构如下所示:

我在 Windows 7 上使用 xampp。我的ci_bootstrap.php文件看起来像上面提到的 AniDear 文章中的那个。

我试图更改ci_bootstrap.php文件中的路径(这似乎是问题所在)但它并没有太大变化。

任何想法如何使这项工作?

问候:)

0 投票
1 回答
619 浏览

php - 测试 PUT/POST/DELETE 方法

我在运行测试PUT和使用单元测试框架phpspec2POST时遇到了一些问题。DELETE

这是我在单元测试中的代码:

通过查看Tonic代码和git 存储库中的示例,我认为我已经正确设置了它。

以下是bin/phpspec -v run本次单元测试的运行结果:

phpspec2 错误

当我对 Tonic 服务运行实际请求时,它工作正常。我知道我在单元测试的设置中一定做错了什么,但我不知道是什么。

编辑:PUT 方法

0 投票
2 回答
923 浏览

php - Writing specs for a class that behaves differently depending upon constructor arguments

If you have a class that responds differently depending upon constructor arguments, how do you go about writing a spec for that class?

Example use:

If I set up my spec for this class using the let function from phpspec:

My spec can only check if the behaviour of this class works in one of the cases.

I've contemplated adding setter methods to allow me to test around this, but it seems like I'd be breaking encapsulation for the purpose of testing.

I'm struggling to find anything that touches upon this, so I'm started to think that maybe this is bad code smell situation.

0 投票
1 回答
4898 浏览

php - PHPUnit 和 PHPSpec 的异同

我目前正在研究我应该为 php 使用哪个测试框架。我有两个选择是 PHPUnit 和 PHPSpec。我知道 PHPUnit 是 TDD(测试驱动开发),而 PHPSpec 是 BDD(行为驱动开发)。然而,由于缺乏任何真正的 PHPSpec 教程和 PHPSpec 站点上的有限文档,我无法得出完整的结论。我对大家的问题是,这两个框架之间有哪些相似之处和不同之处?是的,BDD 和 TDD 很大,但还有其他的吗?它们看起来很相似,但没有人详细谈论它们的相似之处。谢谢你。