Skip to content
This repository was archived by the owner on Feb 20, 2023. It is now read-only.
This repository was archived by the owner on Feb 20, 2023. It is now read-only.

After using setMockClassName can only create one mock. #90

Closed
@georgevanvliet

Description

@georgevanvliet

I am using PHPUnit 3.6.10.

When I have:

class MyClass {

}

Then mock it using:

$mock = $this->getMockBuilder('MyClass')->setMockClassName('someName')->getMock();

I can only create a mock like this once. If I were to execute the same expression again within the same function, or same testCase class (PHPUnit_Framework_TestCase) I get the error:

PHPUnit_Framework_Exception: Class "someName" already exists.

If I don't use the setMockClassName method to explicitly set a class name I can create as many mocks as I want, without errors.

This happens both with getMock and getMockForAbstractClass.

Is this expected behavior ?


Edit by @edorian: Fixed markdown

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