php
php copied to clipboard
Re-write test generator with templates and unit tests
I decided to re-write the test generator based on template files instead of nikic/php-parser
. It had too many limitations. And I didn't want to dig into another huge PHP generation library. Producing the code is not the main problem here.
While learning about the data structure behind the canonical data, I understood that the basic problem is not writing the PHP code but interpreting the data. Based on that idea, showing everything unknown to the user of the generator is key to informed usage.
So I developed a tree of data structures for the known data using TDD. Rendering these structures using templates simplified the process of dumping the code to the file. I documented all that in contribution/documentation/generator
.
It now works for all remaining practice exercises, but does not produce the students file, yet.
What do you think about this approach, @homersimpsons @tomasnorre ?
I won't get time to review this before this weekend (31st March).
I know nothing about plantuml files though.
I really think it would be more test-able using twig templating and flysystem memory storage for tests.
@homersimpsons Don't worry about PlantUML, it is only some Code-To-Diagram application I know. The SVGs in the documentation are made from those files, there is nothing more to it.
I chose plain text files for templates and PHP sprintf()
to fill in stuff. It's very basic.
@homersimpsons Don't worry about PlantUML, it is only some Code-To-Diagram application I know. The SVGs in the documentation are made from those files, there is nothing more to it.
Wouldn't mermaid diagram works?
I chose plain text files for templates and PHP
sprintf()
to fill in stuff. It's very basic.
Okay, but we may be limited to use some loops or conditions.
I'll not find time to read this before after Easter.