API
The Enhance PHP API is made up of the following static methods.
Enhance
-
\Enhance\Core::runTests()
This is the method call that discovers and runs all of the tests.
-
\Enhance\Core::getCodeCoverageWrapper(className, arguments)
This method is used to wrap a class with the code coverage logger, which is a proxy that logs method calls for method coverage reports
-
\Enhance\Core::log(class, methodName)
This method is called by the code coverage logger, but you can also call it manually - it is recommended that you don't though. -
See the article on test classes
MockFactory
-
\Enhance\MockFactory::createMock(typeName)
This method returns a mock object of the specified type
-
See the article on mocks and stubs
StubFactory
-
\Enhance\StubFactory::createStub(typeName)
This method returns a stub object of the specified type - See the article on mocks and stubs
Expect
-
\Enhance\Expect::method(methodName)
Returns an expectation object that can be added to a mock object
-
\Enhance\Expect::getProperty(propertyName)
Returns an expectation object that can be added to a mock object
-
\Enhance\Expect::setProperty(propertyName)
Returns an expectation object that can be added to a mock object -
.with(arg, arg, arg)
Adds argument matchers to the expectation -
.returns(object)
Adds a return value to be returned when the expectation is met -
.throws('An error has occurred')
Adds an exception to be thrown when the expectation is met
-
.times(1)
Sets the number of times the expectation should be used to satisfy the calls
Assert
-
\Enhance\Assert:: i.e. \Enhance\Assert::areIdentical(expected, actual)
Determined whether a test should fail
-
See the article on Assertions
�