Unit tests for HTML Output?

后端 未结 9 1646
无人共我
无人共我 2021-02-19 00:49

This may be a dumb question, but do you make unit tests for the HTML output of your PHP functions/scripts?

I try to keep my HTML and my PHP separate - i.e. HTML includes

9条回答
  •  难免孤独
    2021-02-19 01:25

    A lot of these links are either dead or old. Take a look at http://phpfui.com/PHPFUI/HTMLUnitTester It validated HTML and CSS against w3.org standards. I wrote it because I could not find any recent and currently supported PHP library to do it. Other solutions were based on an old version of PHPUnit or not compatible with modern PHP code.

    It uses the W3C HTML validator service which I would recommend running locally. It is all explained in the readme file in configuration. The beauty of the library is that it does not do the actual validation, but calls the W3C.org code, so it will always be up to date if you keep your local install current.

    Hope this helps.

提交回复
热议问题