Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Class '\PHPSpec\Runner\Reporter\Console' not found #6

@MarcelloDuarte

Description

@MarcelloDuarte

When running phpspec I see:
$ phpspec MySpec.php
PHP Fatal error: Class '\PHPSpec\Runner\Reporter\Console' not found in /usr/share/php/PHPSpec/Runner.php on line 91
$

OS: Ubuntu 9.10
PHP: 5.3.2

The code where the error happens is:
85: if (isset($options->reporter)) {
86: $reporterClass = "\PHPSpec\Runner\Reporter" .
87: ucfirst($options->reporter);
88: } else {
89: $reporterClass = "\PHPSpec\Runner\Reporter\Text";
90: }
91: $reporter = new $reporterClass($result);

This works fine with PHP 5.3.3 in MacOSX
I tried using reflection and using single quote instead of double. Because "reporter" is coming from the cli arguments it is given as a string, so no chance of pass the object directly. Eval works, but I'd rather not use it.

Maybe the solution would be a switch statement. Since it is already limited to the namespace \PHPSpec\Runner\Reporter anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions