athletic
athletic copied to clipboard
Setup instructions are incomplete
Hi! I'm trying to evaluate athletic and I'm having issues getting even a simple example to run. The "sample event" from the readme is obviously not intended to be used as-is, so I
- created a folder
- composer init
- composer require polyfractal/athletic
- created a simple file SleepEvent.php with a class SleepEvent deriving from AthleticEvent
I'm trying to run using "vendor/bin/athletic -p ./SleepingEvent.php", which fails with "ERROR: Class \SleepingEvent does not exist". I've tried various other combinations, but to no avail. The class name in the error message changes slightly, but that's all. I'm using PHP 5.6, in case that matters.
I have found a workaround: If I set up the autoloader to locate that class, I can actually make this work. The necessary stanza in composer.json is
"autoload": {
"psr-4": {
"": ""
}
}
This might be common for many projects, but it still presents a hurdle if you just want to evaluate athletic and should be documented.
-p
takes a directory, I believe, not a single file. Try -p .
instead.
I also get the same error (ERROR: Class \TestClassEvent does not exist).
I've tried to set the -p parameter to both a single file and a directory.
Does anyone know how to solve this?
As suggested by @UlrichEckhardt, autoloading your benchmarking classes worked with me.
"autoload": {
"psr-4": {
"MyCompany\\Benchmarks\\": "benchmarks/"
}
},
Then remember to issue composer dump-autoload
.