You are here

public function PHPUnit_Framework_TestCase::getMockForTrait in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Framework/TestCase.php \PHPUnit_Framework_TestCase::getMockForTrait()

Returns a mock object for the specified trait with all abstract methods of the trait mocked. Concrete methods to mock can be specified with the `$mockedMethods` parameter.

@since Method available since Release 4.0.0

Parameters

string $traitName:

array $arguments:

string $mockClassName:

bool $callOriginalConstructor:

bool $callOriginalClone:

bool $callAutoload:

array $mockedMethods:

bool $cloneArguments:

Return value

PHPUnit_Framework_MockObject_MockObject

Throws

PHPUnit_Framework_Exception

1 call to PHPUnit_Framework_TestCase::getMockForTrait()
Framework_MockObjectTest::testGetMockForTrait in vendor/phpunit/phpunit-mock-objects/tests/MockObjectTest.php
@requires PHP 5.4.0

File

vendor/phpunit/phpunit/src/Framework/TestCase.php, line 1442

Class

PHPUnit_Framework_TestCase
A TestCase defines the fixture to run multiple tests.

Code

public function getMockForTrait($traitName, array $arguments = array(), $mockClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $mockedMethods = array(), $cloneArguments = false) {
  $mockObject = $this
    ->getMockObjectGenerator()
    ->getMockForTrait($traitName, $arguments, $mockClassName, $callOriginalConstructor, $callOriginalClone, $callAutoload, $mockedMethods, $cloneArguments);
  $this->mockObjects[] = $mockObject;
  return $mockObject;
}