What are the solutions?
Reply content:
What are the solutions?
The operation of the program in each PHP version is not exactly the same as running on each browser.
Your problem is easy to mislead people who do not understand, let them mistakenly think that there is a connection, first step on your problem.
From the point of view of PHP execution, I assume that you are writing an open source program and need to collect code to work on each PHP version in order to improve the start.
- PHP provides a comprehensive list of compatibility in each release, which includes new features, deprecated features , and forward compatibility scenarios. I would first suggest that you focus on this list and check your own code for features that may no longer be supported. One of the benefits of doing this is to pay attention to it when you write your code, rather than wait for it to be modified, which can significantly improve your coding efficiency.
Split the problem, think "automated testing in various PHP versions (5.3/5.4/5.5.) is working properly ", as long as" test the PHP program works ", and then say" automation "and" different versions ".
- in software engineering, one way to test whether a program is working correctly is unit testing. This is one of the fundamentals of Agile development Implementation, for each of the smallest units in the code (c is a function, Java is a class, GUI programs may be windows and menus) to write use cases to check, verify that their execution results are expected, unit testing is to ensure that the code strong stability of the important means. Write unit test cases for your own programs, run through these use cases you will get the units you have tested which are successful, which fail, and with plugins like xdebug You can also get coverage of your test code. The more famous unit test framework for PHP is PHPUnit , which you study. Unit testing is the main application of test-driven development (TDD), that is, to write test cases for your program, and then according to these test cases to write business code, this is a very hot way, the advantages are obvious, strict implementation of this process can almost guarantee your code 0 bugs, some shortcomings, Will add a lot of coding effort, so few people in small companies can stick to it. The basic process of test-driven development is the design program--Technology design database--based on program structure to write unit test cases, according to the test Development business code, each development of a version to run test cases, to ensure that the business code successfully passed. At any time the test case does not pass, it is most important to fix your program bug first. The mainstream open source framework will provide some test cases with the program.
- Unit Test your program, you will know where the bug is. Next you will remember to be repeated by the predecessors 10,000 times, what can be done with the machine do not do. Originally write unit test is self-made, each time the code is finished to run it, how tired ah, we need machines for us to work, and not vice versa. For this reason, software engineering also has a concept, " continuous integration ", literally, is to keep running something, in fact, the current continuous integration tool in addition to the frequency of automatic operation, but also support triggers, such as hook git pre Commit (execute before each git commit), use the Continuous integration tool as a platform, support any language through the plugin, open source project, can be unit test framework, Code style (standard) check, generate coverage chart based on unit test, dependency check, DRY (Code repetition degree) Check, etc. PHP is open source, you can think of a lot of tools to go, all can be integrated, unified build, and generate reports. My continuous integration tool is Jenkins, which can be mounted on git or mounted on GitHub. Recently compared to fire (I see quite a lot of open source projects with) is travis-ci.org, as long as the project on GitHub, access it can automatically detect the submission (when you submit the GitHub callback to tell it), according to your project root directory configuration file to build, detailed you go to the official website to see it, of course, support PHP multi-version, Otherwise, why do you think a framework like Yii, Laravel and so on uses it, the configuration file can specify the version directly.
- What you want is a solution, I'm using jenkins-php, I'm not using it to build multiple versions, but it's clear that this tool is designed to address similar needs, and you can set different versions of PHP for each task.
Jenkins installation Method It's official website, you go to install yourself, installed after installing PHP you also find yourself. Here are the dependencies required to build a PHP project, using the Pear or PHP package management tool Composer Install the items mentioned in parentheses, and then install the items in front of the parentheses via the Jenkins backend plugin.
Checkstyle (for processing PHP_CodeSniffer logfiles in Checkstyle format)Clover PHP (for processing PHPUnit code coverage xml output)DRY (for processing phpcpd logfiles in PMD-CPD format)HTML Publisher (for publishing the PHPUnit code coverage report, for instance)JDepend (for processing PHP_Depend logfiles in JDepend format)Plot (for processing phploc CSV output)PMD (for processing PHPMD logfiles in PMD format)Violations (for processing various logfiles)xUnit (for processing PHPUnit logfiles in JUnit format)
Well, sleepy again, the browser section will not talk about the moment.
Because the browser part of the compatibility involves two questions, CSS and JavaScript. The JavaScript section is similar to PHP, using a test framework, writing use cases, and running each browser one at a time.
The difference is that the CSS part of what you write he will not be wrong to display, in addition to your own look, no one knows whether it meets your expectations, here will be the naked eye to distinguish, fortunately, there are some better online tools to support a large number of operating system, browser, resolution of the combination of solutions and snapshots, this has to you to write these.
Short code snippets, with this site very convenient: http://3v4l.org/
Integration testing services such as travis-ci.org can then be used.
Holy shit! You must be a newbie~!
PHP version is the webmaster can choose to use, you why you go to toss each version, to choose the most appropriate version of their own needs, ah, as for the testing of various versions of the browser, currently I am using IETester, write the front-end will be all the browser to consider