[Phpmyadmin-devel] A problem on template tests

Atul Pratap Singh atulpratapsingh05 at gmail.com
Sun May 24 23:18:02 CEST 2015


On Sun, May 24, 2015 at 10:08 PM, 章浩 <jason.daurus at gmail.com> wrote:

>  Hi Singh,
>
> Recently I am working on templates of `tbl_column_definitions.lib.php`,
> and I need some help from you.
>
> I met a problem on the unit test:
>
> [image: Inline image 1]
>
> And here is the test code raise the problem:
>
> [image: Inline image 2]
>
> The failure is caused by the format of HTML, which will not cause any side
> effects for user interface. So what should I do to handle this kind of
> error? Merging spaces in a HTML tag may help, but it seems difficult to
> distinguish a special case:
>
> *Before trimming:*
>
> <script>someScript(); //
>
> anotherScript();</script>
>
> *After trimming:*
>
> <script>someScript(); // anotherScript();</script>
>
> It's obvious that it will cause some Javascripts being commented. Then I
> figured out a second solution: modify the test scripts and let it pass.
> This is a "palliative" solution, we have to spend plenty of time to fix
> this kind of problems.
>
> Maybe we could use a more effective way to test front-end components
> (templates, pages, etc) in the future, though I haven’t figure out how to
> achieve this goal yet.
>
> Could you give me some suggestions about this?
>

Hi devs,

I share Jason's confusion above and doubt the usefulness of unit tests that
are just asserting for static HTML strings in a dynamic HTML output and one
that will keep evolving with course of development.

Also I wonder about its importance as we move to template system[0],
opinions are welcome for possible better ways of doing it. Maybe we can
just test for valid input data getting used by the template and some
important key words but not HTML tags[1]


[0] https://github.com/phpmyadmin/phpmyadmin/pull/1642#discussion_r28551465
[1] http://stackoverflow.com/questions/3429218/unit-tests-for-html-output

Best regards,
>
> Jason
>
>
>

--
Atul Pratap Singh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20150525/d0fc9eeb/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 9613 bytes
Desc: not available
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20150525/d0fc9eeb/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 20659 bytes
Desc: not available
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20150525/d0fc9eeb/attachment-0001.png>


More information about the Developers mailing list