In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail about the configuration and use of PHP unit testing, the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article. Php is quite different from other languages. Unit testing needs to be installed and configured by itself, which is relatively troublesome. However, unit testing is very useful for improving the stability and robustness of the library. Here is how to configure PHP unit tests.
Note: php needs to be upgraded to version 7.1 or above
Configuration instructions 1. Global installation phpunit command script
$wget https://phar.phpunit.de/phpunit-7.0.phar$ chmod + x phpunit-7.0.phar$ sudo mv phpunit-7.0.phar / usr/local/bin/phpunit$ phpunit--versionPHPUnit x.y.z by Sebastian Bergmann and contributors.
two。 Global installation installation phpunit code
Composer global require phpunit/phpunit
3. Create phpunit.xml and put it in your project root. This file is a configuration file that phpunit will read by default:
Tests
4. Configure the phpstorm unit phpunit.phar path, Languages & Frameworks > PHP > PHPUinit
For example, my local path to phpunit is / usr/local/bin/phpunit
5. Configure unit test class hints, Languages & Frameworks > PHP > include path
For example, the local path of my phpunit package is / Users/chenqionghe/.composer/vendor/phpunit
6. The test class that writes 1.Class as Demo for unit tests is DemoTest2. The test class inherits from PHPUnit\ Framework\ TestCase3. Testing method
It must be a public permission, which usually starts with test, or it can be marked with @ test to identify it within the test method. Assertion methods such as assertEquals () are used to assert the match between actual and expected values.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.