Skip to content

PHPunit not expect generic exception? #454

@yangzizhe

Description

@yangzizhe

InvalidArgumentException: You must not expect the generic exception class,
when I test

class MyTest extends PHPUnit_Framework_TestCase
{
/**
* @ExpectedException Exception
* @expectedExceptionMessage Some Message
*/
public function testExceptionHasRightMessage()
{
throw new Exception('Some Message', 20);
}
}

with PHPUnit3.6.7
why ?

IF PHPunit not expect generic exception , why the document has this example?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions