Closed TenshiLyle closed 7 years ago
@sandaemc I will implement this in a different way, which would probably require the user of the Code() class to pass an optional path to their test file. The debug_backtrace()
isn't full proof since we cannot control where the user will instantiate the Code class. E.g. did it call directly from a proof file? Or parent class? Or maybe up on the hierarchy?
How about we put it in a config file and have our library automatically use what's specified in the config file?
The default would be /code
. Then if the user want to override it they would just add a config file.
@sandaemc not sure I understand this completely. What is on the config?
The proof library will look for a config like proof.json
in the base directory of where the proof library was installed as dependency.
proof.json
should just be optional. Example content of the config:
{
"codeFilePath": "/code",
"verbose": true
}
So does this mean that authors will have to update the config file each time they will test their proof?
No, I was thinking of another layer for that. Sorry, I was solving another problem. So we have two problems:
code
code
with the corresponding answer when testing the tests.Adding config will solve the former. For the latter, nothing yet.
Created #17 for the config
Let's try this.
/code
with a config fileHere's the pseudo code
./proof-tester tests/BeautifulWorldTest.php
// Inside the test runner
- Provided a file or a glob, find the counterpart answers
- Copy the answer and paste it into whatever path in proof.json
- Run phpunit tests/BeautifulWorldTest.php
The downside of this approach, is that the tests are run individually in a loop. But I think that is okay.
@sandaemc seems like this isn't going to be part of the php-proof then but on the course file. Or are we generating the test runner for them?
The runner will be part of proof lib
I'll merge #17 with this one. The plan is to make the test runner look for a proof.json
at the current directory. Use it if it's available. Otherwise use the default settings.
Proof writers need to unit tests their proof files locally. We should allow them to pass a path to a php file on the Code constructor. If nothing is passed, then the default
./code
will be used.