athletic icon indicating copy to clipboard operation
athletic copied to clipboard

Setup instructions are incomplete

Open UlrichEckhardt opened this issue 10 years ago • 4 comments

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.

UlrichEckhardt avatar Oct 29 '14 22:10 UlrichEckhardt

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.

UlrichEckhardt avatar Nov 08 '14 17:11 UlrichEckhardt

-p takes a directory, I believe, not a single file. Try -p . instead.

bishopb avatar May 28 '15 18:05 bishopb

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?

stumpdk avatar Sep 25 '15 08:09 stumpdk

As suggested by @UlrichEckhardt, autoloading your benchmarking classes worked with me.

"autoload": {
        "psr-4": {
            "MyCompany\\Benchmarks\\": "benchmarks/"
        }
    },

Then remember to issue composer dump-autoload.

oytuntez avatar Nov 16 '15 15:11 oytuntez