如何在不运行Dev服务器的情况下设置PHPUnit测试框架?

时间:2021-10-02 22:47:16

I don't have control of the Dev server, and may not be able to install or use PHPUnit on it. I installed PHPUnit 3.6 locally on my machine and it requires requires PHP 5.2.7 (or later). But the Dev server is running PHP 5.2.4.

我没有Dev服务器的控制权,可能无法在其上安装或使用PHPUnit。我在我的机器上本地安装了PHPUnit 3.6,它需要PHP 5.2.7(或更高版本)。但是Dev服务器正在运行PHP 5.2.4。

What is the proper way to set up TDD and PHPUnit without running the tests on the dev server? Is it good enough to just run tests locally? Do I need the same versions of PHP and MySQL on the my local machine to do it effectively? (I have MySQL 5.5.16 installed, Dev server is 5.0.xxxx).

如果不在开发服务器上运行测试,设置TDD和PHPUnit的正确方法是什么?在本地运行测试是否足够好?我是否需要在本地计算机上使用相同版本的PHP和MySQL才能有效地执行此操作? (我安装了MySQL 5.5.16,Dev服务器是5.0.xxxx)。

Or can I create a some kind of pseudo-unit test to run on the Dev server to make sure that there are no differences?

或者,我可以创建某种伪单元测试以在Dev服务器上运行以确保没有差异吗?

1 个解决方案

#1


3  

In general you want the same environments across servers, but yes, it is good enough to run the tests locally. Note that PHP 5.2.x has reached end of life. You should update to a 5.3.x version if possible.

通常,您希望跨服务器使用相同的环境,但是,它足以在本地运行测试。请注意,PHP 5.2.x已达到使用寿命。如果可能,您应该更新到5.3.x版本。

#1


3  

In general you want the same environments across servers, but yes, it is good enough to run the tests locally. Note that PHP 5.2.x has reached end of life. You should update to a 5.3.x version if possible.

通常,您希望跨服务器使用相同的环境,但是,它足以在本地运行测试。请注意,PHP 5.2.x已达到使用寿命。如果可能,您应该更新到5.3.x版本。