tapestry-cloud / tapestry

PHP static site generator using the plates template system
https://www.tapestry.cloud/
MIT License
32 stars 1 forks source link

Issue111 refactor unittests #112

Closed carbontwelve closed 7 years ago

carbontwelve commented 7 years ago

While working on #92 I uncovered a bug with how Tapestry identifies command line input. Because Tapestry needs to know the current environment and working directory for the purpose of loading the work space configuration and therefore its kernel (if configured) outside of the console Application, it also isn't aware of command specific input definitions, again because it's looking at the Input before the service providers execute.

This means that when executing build --json which is entirely valid input for the build command, the Symfony console class ArgvInput would throw a RuntimeException because --json doesn't exist within the default definition.

To get around the issue I have created an Input class that filters any input not present in the default definition so that Tapestry can gather --env and --site-dir options without throwing the option does not exist error.

Because of the Symfony core's use of private methods, this required a lot more code that it otherwise would have.