PHPUNIT 无需安装
如果由于某种原因问题很愚蠢,我很抱歉.我不是 phpunit 专家,我的问题听起来很荒谬.
I'm sorry if the question is stupid for some reason. I'm not a phpunit expert and what I'm asking could sound ridiculous.
是否可以不安装使用phpunit?只是包含"这些库而不在服务器上安装任何东西?
Is it possible to use phpunit without installation? Just "include" the libraries without installing anything on the server?
我问这个是因为在我的工作场所没有人想尝试一些单元测试或 TDD,但我很确定当我在测试的帮助下进行编程时我可以做得更好,而且我想展示我的事后它有效"的同事,而不仅仅是通过谈话*.
I'm asking this because at my workplace nobody wants to try some unit testing or TDDing but I'm pretty sure that I can do a better work when I program with the help of the tests and besides I want to show my coworkers that "it works" after the fact, not just by talking*.
感谢您的帮助
*谈话已经发生,答案总是类似于我们有太多工作要做,无法考虑这些花哨的事情".生命似乎太短暂,无法做好工作.
*Talking already happened and the answer is always something like "We have too much work to do to consider these fancy things". Life seems to be too short to do a good job.
推荐答案
PHPUnit 的 github 存储库自述文件 对此有说明.向下滚动到从 Git Checkout 中使用 PHPUnit,查看可以复制粘贴到 shell 中的命令列表.
The readme on PHPUnit's github repository has instructions for this. Scroll down to Using PHPUnit From a Git Checkout for a list of commands you can copy-n-paste into your shell.
要向您的同事明确的一点是,虽然编写测试除了您的常规代码可能看起来需要更多的前期工作,但从长远来看,编写良好的测试将节省您的时间,因为您修复错误并添加功能.它们还使您有信心根据需要进行更剧烈的更改,而您通常可能会考虑从头开始重写项目.
One thing to make clear to your coworkers is that while writing tests in addition to your regular code may seem like more work up front, well-written tests will save you time over the long run as you fix bugs and add features. They also give you the confidence to make more drastic changes as necessary whereas you might normally consider rewriting the project from scratch.
相关文章