Class IntegrationTestCase
A test case class intended to make integration tests of your controllers easier.
This test class provides a number of helper methods and features that make dispatching requests and checking their responses simpler. It favours full integration tests over mock objects as you can test more of your code easily and avoid some of the maintenance pitfalls that mock objects create.
Property Summary
- 
        $_appArgs protectedarray|nullThe customized application constructor arguments. 
- 
        $_appClass protectedstring|nullThe customized application class name. 
- 
        $_configure protectedarrayConfigure values to restore at end of test. 
- 
        $_controller protectedCake\Controller\ControllerThe controller used in the last request. 
- 
        $_cookie protectedarrayCookie data to use in the next request. 
- 
        $_cookieEncryptionKey protectednull|string
- 
        $_csrfToken protectedboolBoolean flag for whether or not the request should have a CSRF token added. 
- 
        $_exception protectedCake\Core\Exception\ExceptionThe exception being thrown if the case. 
- 
        $_layoutName protectedstringThe last rendered layout 
- 
        $_pathRestore protectedarrayPath settings to restore at the end of the test. 
- 
        $_request protectedarrayThe data used to build the next request. 
- 
        $_requestSession protectedCake\Network\SessionThe session instance from the last request 
- 
        $_response protectedCake\Network\ResponseThe response for the most recent request. 
- 
        $_securityToken protectedboolBoolean flag for whether or not the request should have a SecurityComponent token added. 
- 
        $_session protectedarraySession data to use in the next request. 
- 
        $_useHttpServer protectedboolTrack whether or not tests are run against the PSR7 HTTP stack. 
- 
        $_validCiphers protectedarrayValid cipher names for encrypted cookies. 
- 
        $_viewName protectedstringThe last rendered view 
- 
        $autoFixtures publicboolBy default, all fixtures attached to this class will be truncated and reloaded after each test. Set this to false to handle manually 
- 
        $backupGlobals protectedboolEnable or disable the backup and restoration of the $GLOBALS array. Overwrite this attribute in a child class of TestCase. Setting this attribute in setUp() has no effect! 
- 
        $backupGlobalsBlacklist protectedarray
- 
        $backupStaticAttributes protectedboolEnable or disable the backup and restoration of static attributes. Overwrite this attribute in a child class of TestCase. Setting this attribute in setUp() has no effect! 
- 
        $backupStaticAttributesBlacklist protectedarray
- 
        $dropTables publicboolControl table create/drops on each test method. 
- 
        $fixtureManager publicCake\TestSuite\Fixture\FixtureManagerThe class responsible for managing the creation, loading and removing of fixtures 
- 
        $preserveGlobalState protectedboolWhether or not this test should preserve the global state when running in a separate PHP process. 
- 
        $runTestInSeparateProcess protectedboolWhether or not this test is to be run in a separate PHP process. 
Method Summary
- 
          __construct() publicConstructs a test case with the given name. 
- 
          _addTokens() protectedAdd the CSRF and Security Component tokens if necessary. 
- 
          _assertAttributes() protectedCheck the attributes as part of an assertTags() check. 
- 
          _assertStatus() protectedHelper method for status assertions. 
- 
          _buildFieldToken() protectedGenerate the token data for the provided inputs. 
- 
          _buildRequest() protectedCreates a request object with the configured options and parameters. 
- 
          _checkCipher() protectedHelper method for validating encryption cipher names. 
- 
          _decode() protectedDecodes and decrypts a single value. 
- 
          _decrypt() protectedDecrypts $value using public $type method in Security class 
- 
          _encrypt() protectedEncrypts $value using public $type method in Security class 
- 
          _explode() protectedExplode method to return array from string set in CookieComponent::_implode() Maintains reading backwards compatibility with 1.x CookieComponent::_implode(). 
- 
          _getCookieEncryptionKey() protectedReturns the encryption key to be used. 
- 
          _handleError() protectedAttempts to render an error response for a given exception. 
- 
          _implode() protectedImplode method to keep keys are multidimensional arrays 
- 
          _makeDispatcher() protectedGet the correct dispatcher instance. 
- 
          _normalizePath() protectedNormalize a path for comparison. 
- 
          _sendRequest() protectedCreates and send the request into a Dispatcher instance. 
- 
          _url() protectedCreates a valid request url and parameter array more like Request::_url() 
- 
          addToAssertionCount() publicAdds a value to the assertion counter. 
- 
          any() public staticReturns a matcher that matches when the method is executed zero or more times. 
- 
          anything() public staticReturns a PHPUnit_Framework_Constraint_IsAnything matcher object. 
- 
          arrayHasKey() public staticReturns a PHPUnit_Framework_Constraint_ArrayHasKey matcher object. 
- 
          assertArrayHasKey() public staticAsserts that an array has a specified key. 
- 
          assertArrayNotHasKey() public staticAsserts that an array does not have a specified key. 
- 
          assertArraySubset() public staticAsserts that an array has a specified subset. 
- 
          assertAttributeContains() public staticAsserts that a haystack that is stored in a static attribute of a class or an attribute of an object contains a needle. 
- 
          assertAttributeContainsOnly() public staticAsserts that a haystack that is stored in a static attribute of a class or an attribute of an object contains only values of a given type. 
- 
          assertAttributeCount() public staticAsserts the number of elements of an array, Countable or Traversable that is stored in an attribute. 
- 
          assertAttributeEmpty() public staticAsserts that a static attribute of a class or an attribute of an object is empty. 
- 
          assertAttributeEquals() public staticAsserts that a variable is equal to an attribute of an object. 
- 
          assertAttributeGreaterThan() public staticAsserts that an attribute is greater than another value. 
- 
          assertAttributeGreaterThanOrEqual() public staticAsserts that an attribute is greater than or equal to another value. 
- 
          assertAttributeInstanceOf() public staticAsserts that an attribute is of a given type. 
- 
          assertAttributeInternalType() public staticAsserts that an attribute is of a given type. 
- 
          assertAttributeLessThan() public staticAsserts that an attribute is smaller than another value. 
- 
          assertAttributeLessThanOrEqual() public staticAsserts that an attribute is smaller than or equal to another value. 
- 
          assertAttributeNotContains() public staticAsserts that a haystack that is stored in a static attribute of a class or an attribute of an object does not contain a needle. 
- 
          assertAttributeNotContainsOnly() public staticAsserts that a haystack that is stored in a static attribute of a class or an attribute of an object does not contain only values of a given type. 
- 
          assertAttributeNotCount() public staticAsserts the number of elements of an array, Countable or Traversable that is stored in an attribute. 
- 
          assertAttributeNotEmpty() public staticAsserts that a static attribute of a class or an attribute of an object is not empty. 
- 
          assertAttributeNotEquals() public staticAsserts that a variable is not equal to an attribute of an object. 
- 
          assertAttributeNotInstanceOf() public staticAsserts that an attribute is of a given type. 
- 
          assertAttributeNotInternalType() public staticAsserts that an attribute is of a given type. 
- 
          assertAttributeNotSame() public staticAsserts that a variable and an attribute of an object do not have the same type and value. 
- 
          assertAttributeSame() public staticAsserts that a variable and an attribute of an object have the same type and value. 
- 
          assertClassHasAttribute() public staticAsserts that a class has a specified attribute. 
- 
          assertClassHasStaticAttribute() public staticAsserts that a class has a specified static attribute. 
- 
          assertClassNotHasAttribute() public staticAsserts that a class does not have a specified attribute. 
- 
          assertClassNotHasStaticAttribute() public staticAsserts that a class does not have a specified static attribute. 
- 
          assertContains() public staticAsserts that a haystack contains a needle. 
- 
          assertContainsOnly() public staticAsserts that a haystack contains only values of a given type. 
- 
          assertContainsOnlyInstancesOf() public staticAsserts that a haystack contains only instances of a given classname 
- 
          assertContentType() publicAsserts content type 
- 
          assertCookie() publicAsserts cookie values 
- 
          assertCookieEncrypted() publicAsserts cookie values which are encrypted by the CookieComponent. 
- 
          assertCookieNotSet() publicAsserts a cookie has not been set in the response 
- 
          assertCount() public staticAsserts the number of elements of an array, Countable or Traversable. 
- 
          assertDirectoryExists() public staticAsserts that a directory exists. 
- 
          assertDirectoryIsReadable() public staticAsserts that a directory exists and is readable. 
- 
          assertDirectoryIsWritable() public staticAsserts that a directory exists and is writable. 
- 
          assertDirectoryNotExists() public staticAsserts that a directory does not exist. 
- 
          assertDirectoryNotIsReadable() public staticAsserts that a directory exists and is not readable. 
- 
          assertDirectoryNotIsWritable() public staticAsserts that a directory exists and is not writable. 
- 
          assertEmpty() public staticAsserts that a variable is empty. 
- 
          assertEqualXMLStructure() public staticAsserts that a hierarchy of DOMElements matches. 
- 
          assertEquals() public staticAsserts that two variables are equal. 
- 
          assertEventFired() publicAsserts that a global event was fired. You must track events in your event manager for this assertion to work 
- 
          assertEventFiredWith() publicAsserts an event was fired with data 
- 
          assertFalse() public staticAsserts that a condition is false. 
- 
          assertFileEquals() public staticAsserts that the contents of one file is equal to the contents of another file. 
- 
          assertFileExists() public staticAsserts that a file exists. 
- 
          assertFileIsReadable() public staticAsserts that a file exists and is readable. 
- 
          assertFileIsWritable() public staticAsserts that a file exists and is writable. 
- 
          assertFileNotEquals() public staticAsserts that the contents of one file is not equal to the contents of another file. 
- 
          assertFileNotExists() public staticAsserts that a file does not exist. 
- 
          assertFileNotIsReadable() public staticAsserts that a file exists and is not readable. 
- 
          assertFileNotIsWritable() public staticAsserts that a file exists and is not writable. 
- 
          assertFileResponse() publicAsserts that a file with the given name was sent in the response 
- 
          assertFinite() public staticAsserts that a variable is finite. 
- 
          assertGreaterThan() public staticAsserts that a value is greater than another value. 
- 
          assertGreaterThanOrEqual() public staticAsserts that a value is greater than or equal to another value. 
- 
          assertHeader() publicAsserts response headers 
- 
          assertHeaderContains() publicAsserts response header contains a string 
- 
          assertHtml() publicAsserts HTML tags. 
- 
          assertInfinite() public staticAsserts that a variable is infinite. 
- 
          assertInstanceOf() public staticAsserts that a variable is of a given type. 
- 
          assertInternalType() public staticAsserts that a variable is of a given type. 
- 
          assertIsReadable() public staticAsserts that a file/dir is readable. 
- 
          assertIsWritable() public staticAsserts that a file/dir exists and is writable. 
- 
          assertJson() public staticAsserts that a string is a valid JSON string. 
- 
          assertJsonFileEqualsJsonFile() public staticAsserts that two JSON files are equal. 
- 
          assertJsonFileNotEqualsJsonFile() public staticAsserts that two JSON files are not equal. 
- 
          assertJsonStringEqualsJsonFile() public staticAsserts that the generated JSON encoded object and the content of the given file are equal. 
- 
          assertJsonStringEqualsJsonString() public staticAsserts that two given JSON encoded objects or arrays are equal. 
- 
          assertJsonStringNotEqualsJsonFile() public staticAsserts that the generated JSON encoded object and the content of the given file are not equal. 
- 
          assertJsonStringNotEqualsJsonString() public staticAsserts that two given JSON encoded objects or arrays are not equal. 
- 
          assertLayout() publicAsserts that the search string was in the layout name. 
- 
          assertLessThan() public staticAsserts that a value is smaller than another value. 
- 
          assertLessThanOrEqual() public staticAsserts that a value is smaller than or equal to another value. 
- 
          assertNan() public staticAsserts that a variable is nan. 
- 
          assertNoRedirect() publicAsserts that the Location header is not set. 
- 
          assertNotContains() public staticAsserts that a haystack does not contain a needle. 
- 
          assertNotContainsOnly() public staticAsserts that a haystack does not contain only values of a given type. 
- 
          assertNotCount() public staticAsserts the number of elements of an array, Countable or Traversable. 
- 
          assertNotEmpty() public staticAsserts that a variable is not empty. 
- 
          assertNotEquals() public staticAsserts that two variables are not equal. 
- 
          assertNotFalse() public staticAsserts that a condition is not false. 
- 
          assertNotInstanceOf() public staticAsserts that a variable is not of a given type. 
- 
          assertNotInternalType() public staticAsserts that a variable is not of a given type. 
- 
          assertNotIsReadable() public staticAsserts that a file/dir exists and is not readable. 
- 
          assertNotIsWritable() public staticAsserts that a file/dir exists and is not writable. 
- 
          assertNotNull() public staticAsserts that a variable is not null. 
- 
          assertNotRegExp() public staticAsserts that a string does not match a given regular expression. 
- 
          assertNotSame() public staticAsserts that two variables do not have the same type and value. Used on objects, it asserts that two variables do not reference the same object. 
- 
          assertNotSameSize() public staticAssert that the size of two arrays (or CountableorTraversableobjects) is not the same.
- 
          assertNotTrue() public staticAsserts that a condition is not true. 
- 
          assertNotWithinRange() protected staticCompatibility function to test if a value is not between an acceptable range. 
- 
          assertNull() public staticAsserts that a variable is null. 
- 
          assertObjectHasAttribute() public staticAsserts that an object has a specified attribute. 
- 
          assertObjectNotHasAttribute() public staticAsserts that an object does not have a specified attribute. 
- 
          assertPathEquals() protected staticCompatibility function to test paths. 
- 
          assertPostConditions() protectedPerforms assertions shared by all tests of a test case. 
- 
          assertPreConditions() protectedPerforms assertions shared by all tests of a test case. 
- 
          assertRedirect() publicAsserts that the Location header is correct. 
- 
          assertRedirectContains() publicAsserts that the Location header contains a substring 
- 
          assertRegExp() public staticAsserts that a string matches a given regular expression. 
- 
          assertResponseCode() publicAsserts a specific response status code. 
- 
          assertResponseContains() publicAsserts content exists in the response body. 
- 
          assertResponseEmpty() publicAssert response content is empty. 
- 
          assertResponseEquals() publicAsserts content exists in the response body. 
- 
          assertResponseError() publicAsserts that the response status code is in the 4xx range. 
- 
          assertResponseFailure() publicAsserts that the response status code is in the 5xx range. 
- 
          assertResponseNotContains() publicAsserts content does not exist in the response body. 
- 
          assertResponseNotEmpty() publicAssert response content is not empty. 
- 
          assertResponseNotRegExp() publicAsserts that the response body does not match a given regular expression. 
- 
          assertResponseOk() publicAsserts that the response status code is in the 2xx range. 
- 
          assertResponseRegExp() publicAsserts that the response body matches a given regular expression. 
- 
          assertResponseSuccess() publicAsserts that the response status code is in the 2xx/3xx range. 
- 
          assertSame() public staticAsserts that two variables have the same type and value. Used on objects, it asserts that two variables reference the same object. 
- 
          assertSameSize() public staticAssert that the size of two arrays (or CountableorTraversableobjects) is the same.
- 
          assertSession() publicAsserts session contents 
- 
          assertStringEndsNotWith() public staticAsserts that a string ends not with a given suffix. 
- 
          assertStringEndsWith() public staticAsserts that a string ends with a given suffix. 
- 
          assertStringEqualsFile() public staticAsserts that the contents of a string is equal to the contents of a file. 
- 
          assertStringMatchesFormat() public staticAsserts that a string matches a given format string. 
- 
          assertStringMatchesFormatFile() public staticAsserts that a string matches a given format file. 
- 
          assertStringNotEqualsFile() public staticAsserts that the contents of a string is not equal to the contents of a file. 
- 
          assertStringNotMatchesFormat() public staticAsserts that a string does not match a given format string. 
- 
          assertStringNotMatchesFormatFile() public staticAsserts that a string does not match a given format string. 
- 
          assertStringStartsNotWith() public staticAsserts that a string starts not with a given prefix. 
- 
          assertStringStartsWith() public staticAsserts that a string starts with a given prefix. 
- 
          assertTags() public deprecatedAsserts HTML tags. 
- 
          assertTemplate() publicAsserts that the search string was in the template name. 
- 
          assertTextContains() publicAssert that a string contains another string, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text. 
- 
          assertTextEndsNotWith() publicAsserts that a string ends not with a given prefix, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text. 
- 
          assertTextEndsWith() publicAsserts that a string ends with a given prefix, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text. 
- 
          assertTextEquals() publicAssert text equality, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text. 
- 
          assertTextNotContains() publicAssert that a text doesn't contain another text, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text. 
- 
          assertTextNotEquals() publicAssert text equality, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text. 
- 
          assertTextStartsNotWith() publicAsserts that a string starts not with a given prefix, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text. 
- 
          assertTextStartsWith() publicAsserts that a string starts with a given prefix, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text. 
- 
          assertThat() public staticEvaluates a PHPUnit_Framework_Constraint matcher object. 
- 
          assertTrue() public staticAsserts that a condition is true. 
- 
          assertWithinRange() protected staticCompatibility function to test if a value is between an acceptable range. 
- 
          assertXmlFileEqualsXmlFile() public staticAsserts that two XML files are equal. 
- 
          assertXmlFileNotEqualsXmlFile() public staticAsserts that two XML files are not equal. 
- 
          assertXmlStringEqualsXmlFile() public staticAsserts that two XML documents are equal. 
- 
          assertXmlStringEqualsXmlString() public staticAsserts that two XML documents are equal. 
- 
          assertXmlStringNotEqualsXmlFile() public staticAsserts that two XML documents are not equal. 
- 
          assertXmlStringNotEqualsXmlString() public staticAsserts that two XML documents are not equal. 
- 
          at() public staticReturns a matcher that matches when the method is executed at the given index. 
- 
          atLeast() public staticReturns a matcher that matches when the method is executed at least N times. 
- 
          atLeastOnce() public staticReturns a matcher that matches when the method is executed at least once. 
- 
          atMost() public staticReturns a matcher that matches when the method is executed at most N times. 
- 
          attribute() public staticReturns a PHPUnit_Framework_Constraint_Attribute matcher object. 
- 
          attributeEqualTo() public staticReturns a PHPUnit_Framework_Constraint_IsEqual matcher object that is wrapped in a PHPUnit_Framework_Constraint_Attribute matcher object. 
- 
          callback() public staticReturns a PHPUnit_Framework_Constraint_Callback matcher object. 
- 
          checkRequirements() protected
- 
          classHasAttribute() public staticReturns a PHPUnit_Framework_Constraint_ClassHasAttribute matcher object. 
- 
          classHasStaticAttribute() public staticReturns a PHPUnit_Framework_Constraint_ClassHasStaticAttribute matcher object. 
- 
          configApplication() publicConfigure the application class to use in integration tests. 
- 
          configRequest() publicConfigures the data for the next request. 
- 
          contains() public staticReturns a PHPUnit_Framework_Constraint_TraversableContains matcher object. 
- 
          containsOnly() public staticReturns a PHPUnit_Framework_Constraint_TraversableContainsOnly matcher object. 
- 
          containsOnlyInstancesOf() public staticReturns a PHPUnit_Framework_Constraint_TraversableContainsOnly matcher object. 
- 
          controllerSpy() publicAdds additional event spies to the controller/view event manager. 
- 
          cookie() publicSets a request cookie for future requests. 
- 
          cookieEncrypted() publicSets a encrypted request cookie for future requests. 
- 
          count() publicCounts the number of test cases executed by run(TestResult result). 
- 
          countOf() public staticReturns a PHPUnit_Framework_Constraint_Count matcher object. 
- 
          createConfiguredMock() protectedReturns a configured test double for the specified class. 
- 
          createMock() protectedReturns a test double for the specified class. 
- 
          createPartialMock() protectedReturns a partial test double for the specified class. 
- 
          createResult() protectedCreates a default TestResult object. 
- 
          dataDescription() public
- 
          delete() publicPerforms a DELETE request using the current request data. 
- 
          directoryExists() public staticReturns a PHPUnit_Framework_Constraint_DirectoryExists matcher object. 
- 
          doesNotPerformAssertions() public
- 
          enableCsrfToken() publicCalling this method will add a CSRF token to the request. 
- 
          enableSecurityToken() publicCalling this method will enable a SecurityComponent compatible token to be added to request data. This lets you easily test actions protected by SecurityComponent. 
- 
          equalTo() public staticReturns a PHPUnit_Framework_Constraint_IsEqual matcher object. 
- 
          exactly() public staticReturns a matcher that matches when the method is executed exactly $count times. 
- 
          expectException() public
- 
          expectExceptionCode() public
- 
          expectExceptionMessage() public
- 
          expectExceptionMessageRegExp() public
- 
          expectOutputRegex() public
- 
          expectOutputString() public
- 
          fail() public staticFails a test with the given message. 
- 
          fileExists() public staticReturns a PHPUnit_Framework_Constraint_FileExists matcher object. 
- 
          get() publicPerforms a GET request using the current request data. 
- 
          getActualOutput() public
- 
          getAnnotations() publicReturns the annotations for this test. 
- 
          getCount() public staticReturn the current assertion count. 
- 
          getDataSetAsString() protectedGets the data set description of a TestCase. 
- 
          getExpectedException() public
- 
          getGroups() public
- 
          getMock() protected deprecatedReturns a mock object for the specified class. 
- 
          getMockBuilder() publicReturns a builder object to create mock objects using a fluent interface. 
- 
          getMockClass() protectedMocks the specified class and returns the name of the mocked class. 
- 
          getMockForAbstractClass() protectedReturns a mock object for the specified abstract class with all abstract methods of the class mocked. Concrete methods are not mocked by default. To mock concrete methods, use the 7th parameter ($mockedMethods). 
- 
          getMockForModel() publicMock a model, maintain fixtures and table association 
- 
          getMockForTrait() protectedReturns a mock object for the specified trait with all abstract methods of the trait mocked. Concrete methods to mock can be specified with the $mockedMethodsparameter.
- 
          getMockFromWsdl() protectedReturns a mock object based on the given WSDL file. 
- 
          getMockObjectGenerator() protectedGet the mock object generator, creating it if it doesn't exist. 
- 
          getMockWithoutInvokingTheOriginalConstructor() protected deprecatedReturns a mock with disabled constructor object for the specified class. 
- 
          getName() publicGets the name of a TestCase. 
- 
          getNumAssertions() publicReturns the number of assertions performed by this test. 
- 
          getObjectAttribute() public staticReturns the value of an object's attribute. This also works for attributes that are declared protected or private. 
- 
          getObjectForTrait() protectedReturns an object for the specified trait. 
- 
          getProvidedData() protectedGets the data set of a TestCase. 
- 
          getResult() public
- 
          getSize() publicReturns the size of the test. 
- 
          getStaticAttribute() public staticReturns the value of a static attribute. This also works for attributes that are declared protected or private. 
- 
          getStatus() publicReturns the status of this test. 
- 
          getStatusMessage() publicReturns the status message of this test. 
- 
          getTestResultObject() public
- 
          greaterThan() public staticReturns a PHPUnit_Framework_Constraint_GreaterThan matcher object. 
- 
          greaterThanOrEqual() public staticReturns a PHPUnit_Framework_Constraint_Or matcher object that wraps a PHPUnit_Framework_Constraint_IsEqual and a PHPUnit_Framework_Constraint_GreaterThan matcher object. 
- 
          handleDependencies() protected
- 
          hasDependencies() publicReturns true if the tests has dependencies 
- 
          hasExpectationOnOutput() public
- 
          hasFailed() publicReturns whether or not this test has failed. 
- 
          hasOutput() public
- 
          hasPerformedExpectationsOnOutput() public deprecated
- 
          hasSize() public
- 
          identicalTo() public staticReturns a PHPUnit_Framework_Constraint_IsIdentical matcher object. 
- 
          iniSet() protectedThis method is a wrapper for the ini_set() function that automatically resets the modified php.ini setting to its original value after the test is run. 
- 
          isEmpty() public staticReturns a PHPUnit_Framework_Constraint_IsEmpty matcher object. 
- 
          isFalse() public staticReturns a PHPUnit_Framework_Constraint_IsFalse matcher object. 
- 
          isFinite() public staticReturns a PHPUnit_Framework_Constraint_IsFinite matcher object. 
- 
          isInIsolation() public
- 
          isInfinite() public staticReturns a PHPUnit_Framework_Constraint_IsInfinite matcher object. 
- 
          isInstanceOf() public staticReturns a PHPUnit_Framework_Constraint_IsInstanceOf matcher object. 
- 
          isJson() public staticReturns a PHPUnit_Framework_Constraint_IsJson matcher object. 
- 
          isLarge() public
- 
          isMedium() public
- 
          isNan() public staticReturns a PHPUnit_Framework_Constraint_IsNan matcher object. 
- 
          isNull() public staticReturns a PHPUnit_Framework_Constraint_IsNull matcher object. 
- 
          isReadable() public staticReturns a PHPUnit_Framework_Constraint_IsReadable matcher object. 
- 
          isSmall() public
- 
          isTrue() public staticReturns a PHPUnit_Framework_Constraint_IsTrue matcher object. 
- 
          isType() public staticReturns a PHPUnit_Framework_Constraint_IsType matcher object. 
- 
          isWritable() public staticReturns a PHPUnit_Framework_Constraint_IsWritable matcher object. 
- 
          lessThan() public staticReturns a PHPUnit_Framework_Constraint_LessThan matcher object. 
- 
          lessThanOrEqual() public staticReturns a PHPUnit_Framework_Constraint_Or matcher object that wraps a PHPUnit_Framework_Constraint_IsEqual and a PHPUnit_Framework_Constraint_LessThan matcher object. 
- 
          loadFixtures() publicChooses which fixtures to load for a given test 
- 
          logicalAnd() public staticReturns a PHPUnit_Framework_Constraint_And matcher object. 
- 
          logicalNot() public staticReturns a PHPUnit_Framework_Constraint_Not matcher object. 
- 
          logicalOr() public staticReturns a PHPUnit_Framework_Constraint_Or matcher object. 
- 
          logicalXor() public staticReturns a PHPUnit_Framework_Constraint_Xor matcher object. 
- 
          markAsRisky() public
- 
          markTestIncomplete() public staticMark the test as incomplete. 
- 
          markTestSkipped() public staticMark the test as skipped. 
- 
          matches() public staticReturns a PHPUnit_Framework_Constraint_StringMatches matcher object. 
- 
          matchesRegularExpression() public staticReturns a PHPUnit_Framework_Constraint_PCREMatch matcher object. 
- 
          never() public staticReturns a matcher that matches when the method is never executed. 
- 
          objectHasAttribute() public staticReturns a PHPUnit_Framework_Constraint_ObjectHasAttribute matcher object. 
- 
          onConsecutiveCalls() public static
- 
          onNotSuccessfulTest() protectedThis method is called when a test method did not execute successfully. 
- 
          once() public staticReturns a matcher that matches when the method is executed exactly once. 
- 
          patch() publicPerforms a PATCH request using the current request data. 
- 
          post() publicPerforms a POST request using the current request data. 
- 
          prepareTemplate() protectedPerforms custom preparations on the process isolation template. 
- 
          prophesize() protected
- 
          put() publicPerforms a PUT request using the current request data. 
- 
          readAttribute() public staticReturns the value of an attribute of a class or an object. This also works for attributes that are declared protected or private. 
- 
          registerMockObject() public
- 
          resetCount() public staticReset the assertion counter. 
- 
          returnArgument() public static
- 
          returnCallback() public static
- 
          returnSelf() public staticReturns the current object. 
- 
          returnValue() public static
- 
          returnValueMap() public static
- 
          run() publicRuns the test case and collects the results in a TestResult object. If no TestResult object is passed a new one will be created. 
- 
          runBare() publicRuns the bare test sequence. 
- 
          runTest() protectedOverride to run the test and assert its state. 
- 
          session() publicSets session data. 
- 
          setBackupGlobals() publicCalling this method in setUp() has no effect! 
- 
          setBackupStaticAttributes() publicCalling this method in setUp() has no effect! 
- 
          setBeStrictAboutChangesToGlobalState() public
- 
          setDependencies() publicSets the dependencies of a TestCase. 
- 
          setDependencyInput() publicSets 
- 
          setExpectedException() public deprecated
- 
          setExpectedExceptionFromAnnotation() protected
- 
          setExpectedExceptionRegExp() public deprecated
- 
          setGroups() public
- 
          setInIsolation() public
- 
          setLocale() protectedThis method is a wrapper for the setlocale() function that automatically resets the locale to its original value after the test is run. 
- 
          setName() publicSets the name of a TestCase. 
- 
          setOutputCallback() public
- 
          setPreserveGlobalState() public
- 
          setRegisterMockObjectsFromTestArgumentsRecursively() public
- 
          setResult() public
- 
          setRunTestInSeparateProcess() public
- 
          setTestResultObject() public
- 
          setUp() publicAuto-detect if the HTTP middleware stack should be used. 
- 
          setUpBeforeClass() public staticThis method is called before the first test of this test class is run. 
- 
          setUseErrorHandler() public
- 
          setUseErrorHandlerFromAnnotation() protected
- 
          skipIf() publicOverrides SimpleTestCase::skipIf to provide a boolean return value 
- 
          skipUnless() protectedCompatibility function for skipping. 
- 
          stringContains() public staticReturns a PHPUnit_Framework_Constraint_StringContains matcher object. 
- 
          stringEndsWith() public staticReturns a PHPUnit_Framework_Constraint_StringEndsWith matcher object. 
- 
          stringStartsWith() public staticReturns a PHPUnit_Framework_Constraint_StringStartsWith matcher object. 
- 
          tearDown() publicClears the state used for requests. 
- 
          tearDownAfterClass() public staticThis method is called after the last test of this test class is run. 
- 
          throwException() public static
- 
          toString() publicReturns a string representation of the test case. 
- 
          useHttpServer() publicToggle whether or not you want to use the HTTP Server stack. 
- 
          usesDataProvider() public
- 
          verifyMockObjects() protectedVerifies the mock object expectations. 
- 
          viewVariable() publicFetches a view variable by name. 
Method Detail
__construct() ¶ public
__construct(string $name = null, array $data = [], string $dataName = '')Constructs a test case with the given name.
Parameters
- 
                string$name optional
- 
                array$data optional
- 
                string$dataName optional
_addTokens() ¶ protected
_addTokens(string $url, array $data): arrayAdd the CSRF and Security Component tokens if necessary.
Parameters
- 
                string$url
- The URL the form is being submitted on. 
- 
                array$data
- The request body data. 
Returns
arrayThe request body with tokens added.
_assertAttributes() ¶ protected
_assertAttributes(array $assertions, string $string, bool $fullDebug = false, array|string $regex = ''): stringCheck the attributes as part of an assertTags() check.
Parameters
- 
                array$assertions
- Assertions to run. 
- 
                string$string
- The HTML string to check. 
- 
                bool$fullDebug optional
- Whether or not more verbose output should be used. 
- 
                array|string$regex optional
- Full regexp from - assertHtml
Returns
string_assertStatus() ¶ protected
_assertStatus(int $min, int $max, string $message): voidHelper method for status assertions.
Parameters
- 
                int$min
- Min status code. 
- 
                int$max
- Max status code. 
- 
                string$message
- The error message. 
Returns
void_buildFieldToken() ¶ protected
_buildFieldToken(string $url, array $fields, array $unlockedFields = []): arrayGenerate the token data for the provided inputs.
Parameters
- 
                string$url
- The URL the form is being submitted to. 
- 
                array$fields
- If set specifies the list of fields to use when generating the hash. 
- 
                array$unlockedFields optional
- The list of fields that are excluded from field validation. 
Returns
arrayThe token data.
_buildRequest() ¶ protected
_buildRequest(string|array $url, string $method, array|null $data): arrayCreates a request object with the configured options and parameters.
Parameters
- 
                string|array$url
- The URL 
- 
                string$method
- The HTTP method 
- 
                array|null$data
- The request data. 
Returns
arrayThe request context
_checkCipher() ¶ protected
_checkCipher(string $encrypt): voidHelper method for validating encryption cipher names.
Parameters
- 
                string$encrypt
- The cipher name. 
Returns
voidThrows
RuntimeExceptionWhen an invalid cipher is provided.
_decode() ¶ protected
_decode(string $value, string|false $encrypt, string|null $key): stringDecodes and decrypts a single value.
Parameters
- 
                string$value
- The value to decode & decrypt. 
- 
                string|false$encrypt
- The encryption cipher to use. 
- 
                string|null$key
- Used as the security salt if specified. 
Returns
stringDecoded value.
_decrypt() ¶ protected
_decrypt(array $values, string|bool $mode, string|null $key = null): stringDecrypts $value using public $type method in Security class
Parameters
- 
                array$values
- Values to decrypt 
- 
                string|bool$mode
- Encryption mode 
- 
                string|null$key optional
- Used as the security salt if specified. 
Returns
stringdecrypted string
_encrypt() ¶ protected
_encrypt(string $value, string|bool $encrypt, string|null $key = null): stringEncrypts $value using public $type method in Security class
Parameters
- 
                string$value
- Value to encrypt 
- 
                string|bool$encrypt
- Encryption mode to use. False disabled encryption. 
- 
                string|null$key optional
- Used as the security salt if specified. 
Returns
stringEncoded values
_explode() ¶ protected
_explode(string $string): arrayExplode method to return array from string set in CookieComponent::_implode() Maintains reading backwards compatibility with 1.x CookieComponent::_implode().
Parameters
- 
                string$string
- A string containing JSON encoded data, or a bare string. 
Returns
arrayMap of key and values
_getCookieEncryptionKey() ¶ protected
_getCookieEncryptionKey(): stringReturns the encryption key to be used.
Returns
string_handleError() ¶ protected
_handleError(Exception $exception): voidAttempts to render an error response for a given exception.
This method will attempt to use the configured exception renderer. If that class does not exist, the built-in renderer will be used.
Parameters
- 
                Exception$exception
- Exception to handle. 
Returns
voidThrows
Exception_implode() ¶ protected
_implode(array $array): stringImplode method to keep keys are multidimensional arrays
Parameters
- 
                array$array
- Map of key and values 
Returns
stringA json encoded string.
_makeDispatcher() ¶ protected
_makeDispatcher(): objectGet the correct dispatcher instance.
Returns
objectA dispatcher instance
_normalizePath() ¶ protected
_normalizePath(string $path): stringNormalize a path for comparison.
Parameters
- 
                string$path
- Path separated by "/" slash. 
Returns
stringNormalized path separated by DIRECTORY_SEPARATOR.
_sendRequest() ¶ protected
_sendRequest(string|array $url, string $method, array|null $data = []): voidCreates and send the request into a Dispatcher instance.
Receives and stores the response for future inspection.
Parameters
- 
                string|array$url
- The URL 
- 
                string$method
- The HTTP method 
- 
                array|null$data optional
- The request data. 
Returns
voidThrows
Exception_url() ¶ protected
_url(string|array $url): arrayCreates a valid request url and parameter array more like Request::_url()
Parameters
- 
                string|array$url
- The URL 
Returns
arrayQualified URL and the query parameters
addToAssertionCount() ¶ public
addToAssertionCount(int $count)Adds a value to the assertion counter.
Parameters
- 
                int$count
any() ¶ public static
any(): PHPUnit_Framework_MockObject_Matcher_AnyInvokedCountReturns a matcher that matches when the method is executed zero or more times.
Returns
PHPUnit_Framework_MockObject_Matcher_AnyInvokedCountanything() ¶ public static
anything(): PHPUnit_Framework_Constraint_IsAnythingReturns a PHPUnit_Framework_Constraint_IsAnything matcher object.
Returns
PHPUnit_Framework_Constraint_IsAnythingarrayHasKey() ¶ public static
arrayHasKey(mixed $key): PHPUnit_Framework_Constraint_ArrayHasKeyReturns a PHPUnit_Framework_Constraint_ArrayHasKey matcher object.
Parameters
- 
                mixed$key
Returns
PHPUnit_Framework_Constraint_ArrayHasKeyassertArrayHasKey() ¶ public static
assertArrayHasKey(mixed $key, array|ArrayAccess $array, string $message = '')Asserts that an array has a specified key.
Parameters
- 
                mixed$key
- 
                array|ArrayAccess$array
- 
                string$message optional
assertArrayNotHasKey() ¶ public static
assertArrayNotHasKey(mixed $key, array|ArrayAccess $array, string $message = '')Asserts that an array does not have a specified key.
Parameters
- 
                mixed$key
- 
                array|ArrayAccess$array
- 
                string$message optional
assertArraySubset() ¶ public static
assertArraySubset(array|ArrayAccess $subset, array|ArrayAccess $array, bool $strict = false, string $message = '')Asserts that an array has a specified subset.
Parameters
- 
                array|ArrayAccess$subset
- 
                array|ArrayAccess$array
- 
                bool$strict optional
- Check for object identity 
- 
                string$message optional
assertAttributeContains() ¶ public static
assertAttributeContains(mixed $needle, string $haystackAttributeName, string|object $haystackClassOrObject, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false)Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object contains a needle.
Parameters
- 
                mixed$needle
- 
                string$haystackAttributeName
- 
                string|object$haystackClassOrObject
- 
                string$message optional
- 
                bool$ignoreCase optional
- 
                bool$checkForObjectIdentity optional
- 
                bool$checkForNonObjectIdentity optional
assertAttributeContainsOnly() ¶ public static
assertAttributeContainsOnly(string $type, string $haystackAttributeName, string|object $haystackClassOrObject, bool $isNativeType = null, string $message = '')Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object contains only values of a given type.
Parameters
- 
                string$type
- 
                string$haystackAttributeName
- 
                string|object$haystackClassOrObject
- 
                bool$isNativeType optional
- 
                string$message optional
assertAttributeCount() ¶ public static
assertAttributeCount(int $expectedCount, string $haystackAttributeName, string|object $haystackClassOrObject, string $message = '')Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.
Parameters
- 
                int$expectedCount
- 
                string$haystackAttributeName
- 
                string|object$haystackClassOrObject
- 
                string$message optional
assertAttributeEmpty() ¶ public static
assertAttributeEmpty(string $haystackAttributeName, string|object $haystackClassOrObject, string $message = '')Asserts that a static attribute of a class or an attribute of an object is empty.
Parameters
- 
                string$haystackAttributeName
- 
                string|object$haystackClassOrObject
- 
                string$message optional
assertAttributeEquals() ¶ public static
assertAttributeEquals(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false)Asserts that a variable is equal to an attribute of an object.
Parameters
- 
                mixed$expected
- 
                string$actualAttributeName
- 
                string|object$actualClassOrObject
- 
                string$message optional
- 
                float$delta optional
- 
                int$maxDepth optional
- 
                bool$canonicalize optional
- 
                bool$ignoreCase optional
assertAttributeGreaterThan() ¶ public static
assertAttributeGreaterThan(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '')Asserts that an attribute is greater than another value.
Parameters
- 
                mixed$expected
- 
                string$actualAttributeName
- 
                string|object$actualClassOrObject
- 
                string$message optional
assertAttributeGreaterThanOrEqual() ¶ public static
assertAttributeGreaterThanOrEqual(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '')Asserts that an attribute is greater than or equal to another value.
Parameters
- 
                mixed$expected
- 
                string$actualAttributeName
- 
                string|object$actualClassOrObject
- 
                string$message optional
assertAttributeInstanceOf() ¶ public static
assertAttributeInstanceOf(string $expected, string $attributeName, string|object $classOrObject, string $message = '')Asserts that an attribute is of a given type.
Parameters
- 
                string$expected
- 
                string$attributeName
- 
                string|object$classOrObject
- 
                string$message optional
assertAttributeInternalType() ¶ public static
assertAttributeInternalType(string $expected, string $attributeName, string|object $classOrObject, string $message = '')Asserts that an attribute is of a given type.
Parameters
- 
                string$expected
- 
                string$attributeName
- 
                string|object$classOrObject
- 
                string$message optional
assertAttributeLessThan() ¶ public static
assertAttributeLessThan(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '')Asserts that an attribute is smaller than another value.
Parameters
- 
                mixed$expected
- 
                string$actualAttributeName
- 
                string|object$actualClassOrObject
- 
                string$message optional
assertAttributeLessThanOrEqual() ¶ public static
assertAttributeLessThanOrEqual(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '')Asserts that an attribute is smaller than or equal to another value.
Parameters
- 
                mixed$expected
- 
                string$actualAttributeName
- 
                string|object$actualClassOrObject
- 
                string$message optional
assertAttributeNotContains() ¶ public static
assertAttributeNotContains(mixed $needle, string $haystackAttributeName, string|object $haystackClassOrObject, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false)Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object does not contain a needle.
Parameters
- 
                mixed$needle
- 
                string$haystackAttributeName
- 
                string|object$haystackClassOrObject
- 
                string$message optional
- 
                bool$ignoreCase optional
- 
                bool$checkForObjectIdentity optional
- 
                bool$checkForNonObjectIdentity optional
assertAttributeNotContainsOnly() ¶ public static
assertAttributeNotContainsOnly(string $type, string $haystackAttributeName, string|object $haystackClassOrObject, bool $isNativeType = null, string $message = '')Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object does not contain only values of a given type.
Parameters
- 
                string$type
- 
                string$haystackAttributeName
- 
                string|object$haystackClassOrObject
- 
                bool$isNativeType optional
- 
                string$message optional
assertAttributeNotCount() ¶ public static
assertAttributeNotCount(int $expectedCount, string $haystackAttributeName, string|object $haystackClassOrObject, string $message = '')Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.
Parameters
- 
                int$expectedCount
- 
                string$haystackAttributeName
- 
                string|object$haystackClassOrObject
- 
                string$message optional
assertAttributeNotEmpty() ¶ public static
assertAttributeNotEmpty(string $haystackAttributeName, string|object $haystackClassOrObject, string $message = '')Asserts that a static attribute of a class or an attribute of an object is not empty.
Parameters
- 
                string$haystackAttributeName
- 
                string|object$haystackClassOrObject
- 
                string$message optional
assertAttributeNotEquals() ¶ public static
assertAttributeNotEquals(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false)Asserts that a variable is not equal to an attribute of an object.
Parameters
- 
                mixed$expected
- 
                string$actualAttributeName
- 
                string|object$actualClassOrObject
- 
                string$message optional
- 
                float$delta optional
- 
                int$maxDepth optional
- 
                bool$canonicalize optional
- 
                bool$ignoreCase optional
assertAttributeNotInstanceOf() ¶ public static
assertAttributeNotInstanceOf(string $expected, string $attributeName, string|object $classOrObject, string $message = '')Asserts that an attribute is of a given type.
Parameters
- 
                string$expected
- 
                string$attributeName
- 
                string|object$classOrObject
- 
                string$message optional
assertAttributeNotInternalType() ¶ public static
assertAttributeNotInternalType(string $expected, string $attributeName, string|object $classOrObject, string $message = '')Asserts that an attribute is of a given type.
Parameters
- 
                string$expected
- 
                string$attributeName
- 
                string|object$classOrObject
- 
                string$message optional
assertAttributeNotSame() ¶ public static
assertAttributeNotSame(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '')Asserts that a variable and an attribute of an object do not have the same type and value.
Parameters
- 
                mixed$expected
- 
                string$actualAttributeName
- 
                string|object$actualClassOrObject
- 
                string$message optional
assertAttributeSame() ¶ public static
assertAttributeSame(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '')Asserts that a variable and an attribute of an object have the same type and value.
Parameters
- 
                mixed$expected
- 
                string$actualAttributeName
- 
                string|object$actualClassOrObject
- 
                string$message optional
assertClassHasAttribute() ¶ public static
assertClassHasAttribute(string $attributeName, string $className, string $message = '')Asserts that a class has a specified attribute.
Parameters
- 
                string$attributeName
- 
                string$className
- 
                string$message optional
assertClassHasStaticAttribute() ¶ public static
assertClassHasStaticAttribute(string $attributeName, string $className, string $message = '')Asserts that a class has a specified static attribute.
Parameters
- 
                string$attributeName
- 
                string$className
- 
                string$message optional
assertClassNotHasAttribute() ¶ public static
assertClassNotHasAttribute(string $attributeName, string $className, string $message = '')Asserts that a class does not have a specified attribute.
Parameters
- 
                string$attributeName
- 
                string$className
- 
                string$message optional
assertClassNotHasStaticAttribute() ¶ public static
assertClassNotHasStaticAttribute(string $attributeName, string $className, string $message = '')Asserts that a class does not have a specified static attribute.
Parameters
- 
                string$attributeName
- 
                string$className
- 
                string$message optional
assertContains() ¶ public static
assertContains(mixed $needle, mixed $haystack, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false)Asserts that a haystack contains a needle.
Parameters
- 
                mixed$needle
- 
                mixed$haystack
- 
                string$message optional
- 
                bool$ignoreCase optional
- 
                bool$checkForObjectIdentity optional
- 
                bool$checkForNonObjectIdentity optional
assertContainsOnly() ¶ public static
assertContainsOnly(string $type, mixed $haystack, bool $isNativeType = null, string $message = '')Asserts that a haystack contains only values of a given type.
Parameters
- 
                string$type
- 
                mixed$haystack
- 
                bool$isNativeType optional
- 
                string$message optional
assertContainsOnlyInstancesOf() ¶ public static
assertContainsOnlyInstancesOf(string $classname, array|Traversable $haystack, string $message = '')Asserts that a haystack contains only instances of a given classname
Parameters
- 
                string$classname
- 
                array|Traversable$haystack
- 
                string$message optional
assertContentType() ¶ public
assertContentType(string $type, string $message = ''): voidAsserts content type
Parameters
- 
                string$type
- The content-type to check for. 
- 
                string$message optional
- The failure message that will be appended to the generated message. 
Returns
voidassertCookie() ¶ public
assertCookie(string $expected, string $name, string $message = ''): voidAsserts cookie values
Parameters
- 
                string$expected
- The expected contents. 
- 
                string$name
- The cookie name. 
- 
                string$message optional
- The failure message that will be appended to the generated message. 
Returns
voidassertCookieEncrypted() ¶ public
assertCookieEncrypted(string $expected, string $name, string|bool $encrypt = 'aes', string|null $key = null, string $message = ''): voidAsserts cookie values which are encrypted by the CookieComponent.
The difference from assertCookie() is this decrypts the cookie value like the CookieComponent for this assertion.
Parameters
- 
                string$expected
- The expected contents. 
- 
                string$name
- The cookie name. 
- 
                string|bool$encrypt optional
- Encryption mode to use. 
- 
                string|null$key optional
- Encryption key used. Defaults to Security.salt. 
- 
                string$message optional
- The failure message that will be appended to the generated message. 
Returns
voidSee Also
assertCookieNotSet() ¶ public
assertCookieNotSet(string $cookie, string $message = ''): voidAsserts a cookie has not been set in the response
Parameters
- 
                string$cookie
- The cookie name to check 
- 
                string$message optional
- The failure message that will be appended to the generated message. 
Returns
voidassertCount() ¶ public static
assertCount(int $expectedCount, mixed $haystack, string $message = '')Asserts the number of elements of an array, Countable or Traversable.
Parameters
- 
                int$expectedCount
- 
                mixed$haystack
- 
                string$message optional
assertDirectoryExists() ¶ public static
assertDirectoryExists(string $directory, string $message = '')Asserts that a directory exists.
Parameters
- 
                string$directory
- 
                string$message optional
assertDirectoryIsReadable() ¶ public static
assertDirectoryIsReadable(string $directory, string $message = '')Asserts that a directory exists and is readable.
Parameters
- 
                string$directory
- 
                string$message optional
assertDirectoryIsWritable() ¶ public static
assertDirectoryIsWritable(string $directory, string $message = '')Asserts that a directory exists and is writable.
Parameters
- 
                string$directory
- 
                string$message optional
assertDirectoryNotExists() ¶ public static
assertDirectoryNotExists(string $directory, string $message = '')Asserts that a directory does not exist.
Parameters
- 
                string$directory
- 
                string$message optional
assertDirectoryNotIsReadable() ¶ public static
assertDirectoryNotIsReadable(string $directory, string $message = '')Asserts that a directory exists and is not readable.
Parameters
- 
                string$directory
- 
                string$message optional
assertDirectoryNotIsWritable() ¶ public static
assertDirectoryNotIsWritable(string $directory, string $message = '')Asserts that a directory exists and is not writable.
Parameters
- 
                string$directory
- 
                string$message optional
assertEmpty() ¶ public static
assertEmpty(mixed $actual, string $message = '')Asserts that a variable is empty.
Parameters
- 
                mixed$actual
- 
                string$message optional
Throws
PHPUnit_Framework_AssertionFailedErrorassertEqualXMLStructure() ¶ public static
assertEqualXMLStructure(DOMElement $expectedElement, DOMElement $actualElement, bool $checkAttributes = false, string $message = '')Asserts that a hierarchy of DOMElements matches.
Parameters
- 
                DOMElement$expectedElement
- 
                DOMElement$actualElement
- 
                bool$checkAttributes optional
- 
                string$message optional
assertEquals() ¶ public static
assertEquals(mixed $expected, mixed $actual, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false)Asserts that two variables are equal.
Parameters
- 
                mixed$expected
- 
                mixed$actual
- 
                string$message optional
- 
                float$delta optional
- 
                int$maxDepth optional
- 
                bool$canonicalize optional
- 
                bool$ignoreCase optional
assertEventFired() ¶ public
assertEventFired(string $name, EventManager|null $eventManager = null, string $message = ''): voidAsserts that a global event was fired. You must track events in your event manager for this assertion to work
Parameters
- 
                string$name
- Event name 
- 
                EventManager|null$eventManager optional
- Event manager to check, defaults to global event manager 
- 
                string$message optional
- Assertion failure message 
Returns
voidassertEventFiredWith() ¶ public
assertEventFiredWith(string $name, string $dataKey, string $dataValue, EventManager|null $eventManager = null, string $message = ''): voidAsserts an event was fired with data
If a third argument is passed, that value is used to compare with the value in $dataKey
Parameters
- 
                string$name
- Event name 
- 
                string$dataKey
- Data key 
- 
                string$dataValue
- Data value 
- 
                EventManager|null$eventManager optional
- Event manager to check, defaults to global event manager 
- 
                string$message optional
- Assertion failure message 
Returns
voidassertFalse() ¶ public static
assertFalse(bool $condition, string $message = '')Asserts that a condition is false.
Parameters
- 
                bool$condition
- 
                string$message optional
Throws
PHPUnit_Framework_AssertionFailedErrorassertFileEquals() ¶ public static
assertFileEquals(string $expected, string $actual, string $message = '', bool $canonicalize = false, bool $ignoreCase = false)Asserts that the contents of one file is equal to the contents of another file.
Parameters
- 
                string$expected
- 
                string$actual
- 
                string$message optional
- 
                bool$canonicalize optional
- 
                bool$ignoreCase optional
assertFileExists() ¶ public static
assertFileExists(string $filename, string $message = '')Asserts that a file exists.
Parameters
- 
                string$filename
- 
                string$message optional
assertFileIsReadable() ¶ public static
assertFileIsReadable(string $file, string $message = '')Asserts that a file exists and is readable.
Parameters
- 
                string$file
- 
                string$message optional
assertFileIsWritable() ¶ public static
assertFileIsWritable(string $file, string $message = '')Asserts that a file exists and is writable.
Parameters
- 
                string$file
- 
                string$message optional
assertFileNotEquals() ¶ public static
assertFileNotEquals(string $expected, string $actual, string $message = '', bool $canonicalize = false, bool $ignoreCase = false)Asserts that the contents of one file is not equal to the contents of another file.
Parameters
- 
                string$expected
- 
                string$actual
- 
                string$message optional
- 
                bool$canonicalize optional
- 
                bool$ignoreCase optional
assertFileNotExists() ¶ public static
assertFileNotExists(string $filename, string $message = '')Asserts that a file does not exist.
Parameters
- 
                string$filename
- 
                string$message optional
assertFileNotIsReadable() ¶ public static
assertFileNotIsReadable(string $file, string $message = '')Asserts that a file exists and is not readable.
Parameters
- 
                string$file
- 
                string$message optional
assertFileNotIsWritable() ¶ public static
assertFileNotIsWritable(string $file, string $message = '')Asserts that a file exists and is not writable.
Parameters
- 
                string$file
- 
                string$message optional
assertFileResponse() ¶ public
assertFileResponse(string $expected, string $message = ''): voidAsserts that a file with the given name was sent in the response
Parameters
- 
                string$expected
- The file name that should be sent in the response 
- 
                string$message optional
- The failure message that will be appended to the generated message. 
Returns
voidassertFinite() ¶ public static
assertFinite(mixed $actual, string $message = '')Asserts that a variable is finite.
Parameters
- 
                mixed$actual
- 
                string$message optional
assertGreaterThan() ¶ public static
assertGreaterThan(mixed $expected, mixed $actual, string $message = '')Asserts that a value is greater than another value.
Parameters
- 
                mixed$expected
- 
                mixed$actual
- 
                string$message optional
assertGreaterThanOrEqual() ¶ public static
assertGreaterThanOrEqual(mixed $expected, mixed $actual, string $message = '')Asserts that a value is greater than or equal to another value.
Parameters
- 
                mixed$expected
- 
                mixed$actual
- 
                string$message optional
assertHeader() ¶ public
assertHeader(string $header, string $content, string $message = ''): voidAsserts response headers
Parameters
- 
                string$header
- The header to check 
- 
                string$content
- The content to check for. 
- 
                string$message optional
- The failure message that will be appended to the generated message. 
Returns
voidassertHeaderContains() ¶ public
assertHeaderContains(string $header, string $content, string $message = ''): voidAsserts response header contains a string
Parameters
- 
                string$header
- The header to check 
- 
                string$content
- The content to check for. 
- 
                string$message optional
- The failure message that will be appended to the generated message. 
Returns
voidassertHtml() ¶ public
assertHtml(array $expected, string $string, bool $fullDebug = false): boolAsserts HTML tags.
Takes an array $expected and generates a regex from it to match the provided $string. Samples for $expected:
Checks for an input tag with a name attribute (contains any non-empty value) and an id attribute that contains 'my-input':
['input' => ['name', 'id' => 'my-input']]Checks for two p elements with some text in them:
[
  ['p' => true],
  'textA',
  '/p',
  ['p' => true],
  'textB',
  '/p'
]You can also specify a pattern expression as part of the attribute values, or the tag being defined, if you prepend the value with preg: and enclose it with slashes, like so:
[
  ['input' => ['name', 'id' => 'preg:/FieldName\d+/']],
  'preg:/My\s+field/'
]Important: This function is very forgiving about whitespace and also accepts any permutation of attribute order. It will also allow whitespace between specified tags.
Parameters
- 
                array$expected
- An array, see above 
- 
                string$string
- An HTML/XHTML/XML string 
- 
                bool$fullDebug optional
- Whether or not more verbose output should be used. 
Returns
boolassertInfinite() ¶ public static
assertInfinite(mixed $actual, string $message = '')Asserts that a variable is infinite.
Parameters
- 
                mixed$actual
- 
                string$message optional
assertInstanceOf() ¶ public static
assertInstanceOf(string $expected, mixed $actual, string $message = '')Asserts that a variable is of a given type.
Parameters
- 
                string$expected
- 
                mixed$actual
- 
                string$message optional
assertInternalType() ¶ public static
assertInternalType(string $expected, mixed $actual, string $message = '')Asserts that a variable is of a given type.
Parameters
- 
                string$expected
- 
                mixed$actual
- 
                string$message optional
assertIsReadable() ¶ public static
assertIsReadable(string $filename, string $message = '')Asserts that a file/dir is readable.
Parameters
- 
                string$filename
- 
                string$message optional
assertIsWritable() ¶ public static
assertIsWritable(string $filename, string $message = '')Asserts that a file/dir exists and is writable.
Parameters
- 
                string$filename
- 
                string$message optional
assertJson() ¶ public static
assertJson(string $actualJson, string $message = '')Asserts that a string is a valid JSON string.
Parameters
- 
                string$actualJson
- 
                string$message optional
assertJsonFileEqualsJsonFile() ¶ public static
assertJsonFileEqualsJsonFile(string $expectedFile, string $actualFile, string $message = '')Asserts that two JSON files are equal.
Parameters
- 
                string$expectedFile
- 
                string$actualFile
- 
                string$message optional
assertJsonFileNotEqualsJsonFile() ¶ public static
assertJsonFileNotEqualsJsonFile(string $expectedFile, string $actualFile, string $message = '')Asserts that two JSON files are not equal.
Parameters
- 
                string$expectedFile
- 
                string$actualFile
- 
                string$message optional
assertJsonStringEqualsJsonFile() ¶ public static
assertJsonStringEqualsJsonFile(string $expectedFile, string $actualJson, string $message = '')Asserts that the generated JSON encoded object and the content of the given file are equal.
Parameters
- 
                string$expectedFile
- 
                string$actualJson
- 
                string$message optional
assertJsonStringEqualsJsonString() ¶ public static
assertJsonStringEqualsJsonString(string $expectedJson, string $actualJson, string $message = '')Asserts that two given JSON encoded objects or arrays are equal.
Parameters
- 
                string$expectedJson
- 
                string$actualJson
- 
                string$message optional
assertJsonStringNotEqualsJsonFile() ¶ public static
assertJsonStringNotEqualsJsonFile(string $expectedFile, string $actualJson, string $message = '')Asserts that the generated JSON encoded object and the content of the given file are not equal.
Parameters
- 
                string$expectedFile
- 
                string$actualJson
- 
                string$message optional
assertJsonStringNotEqualsJsonString() ¶ public static
assertJsonStringNotEqualsJsonString(string $expectedJson, string $actualJson, string $message = '')Asserts that two given JSON encoded objects or arrays are not equal.
Parameters
- 
                string$expectedJson
- 
                string$actualJson
- 
                string$message optional
assertLayout() ¶ public
assertLayout(string $content, string $message = ''): voidAsserts that the search string was in the layout name.
Parameters
- 
                string$content
- The content to check for. 
- 
                string$message optional
- The failure message that will be appended to the generated message. 
Returns
voidassertLessThan() ¶ public static
assertLessThan(mixed $expected, mixed $actual, string $message = '')Asserts that a value is smaller than another value.
Parameters
- 
                mixed$expected
- 
                mixed$actual
- 
                string$message optional
assertLessThanOrEqual() ¶ public static
assertLessThanOrEqual(mixed $expected, mixed $actual, string $message = '')Asserts that a value is smaller than or equal to another value.
Parameters
- 
                mixed$expected
- 
                mixed$actual
- 
                string$message optional
assertNan() ¶ public static
assertNan(mixed $actual, string $message = '')Asserts that a variable is nan.
Parameters
- 
                mixed$actual
- 
                string$message optional
assertNoRedirect() ¶ public
assertNoRedirect(string $message = ''): voidAsserts that the Location header is not set.
Parameters
- 
                string$message optional
- The failure message that will be appended to the generated message. 
Returns
voidassertNotContains() ¶ public static
assertNotContains(mixed $needle, mixed $haystack, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false)Asserts that a haystack does not contain a needle.
Parameters
- 
                mixed$needle
- 
                mixed$haystack
- 
                string$message optional
- 
                bool$ignoreCase optional
- 
                bool$checkForObjectIdentity optional
- 
                bool$checkForNonObjectIdentity optional
assertNotContainsOnly() ¶ public static
assertNotContainsOnly(string $type, mixed $haystack, bool $isNativeType = null, string $message = '')Asserts that a haystack does not contain only values of a given type.
Parameters
- 
                string$type
- 
                mixed$haystack
- 
                bool$isNativeType optional
- 
                string$message optional
assertNotCount() ¶ public static
assertNotCount(int $expectedCount, mixed $haystack, string $message = '')Asserts the number of elements of an array, Countable or Traversable.
Parameters
- 
                int$expectedCount
- 
                mixed$haystack
- 
                string$message optional
assertNotEmpty() ¶ public static
assertNotEmpty(mixed $actual, string $message = '')Asserts that a variable is not empty.
Parameters
- 
                mixed$actual
- 
                string$message optional
Throws
PHPUnit_Framework_AssertionFailedErrorassertNotEquals() ¶ public static
assertNotEquals(mixed $expected, mixed $actual, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false)Asserts that two variables are not equal.
Parameters
- 
                mixed$expected
- 
                mixed$actual
- 
                string$message optional
- 
                float$delta optional
- 
                int$maxDepth optional
- 
                bool$canonicalize optional
- 
                bool$ignoreCase optional
assertNotFalse() ¶ public static
assertNotFalse(bool $condition, string $message = '')Asserts that a condition is not false.
Parameters
- 
                bool$condition
- 
                string$message optional
Throws
PHPUnit_Framework_AssertionFailedErrorassertNotInstanceOf() ¶ public static
assertNotInstanceOf(string $expected, mixed $actual, string $message = '')Asserts that a variable is not of a given type.
Parameters
- 
                string$expected
- 
                mixed$actual
- 
                string$message optional
assertNotInternalType() ¶ public static
assertNotInternalType(string $expected, mixed $actual, string $message = '')Asserts that a variable is not of a given type.
Parameters
- 
                string$expected
- 
                mixed$actual
- 
                string$message optional
assertNotIsReadable() ¶ public static
assertNotIsReadable(string $filename, string $message = '')Asserts that a file/dir exists and is not readable.
Parameters
- 
                string$filename
- 
                string$message optional
assertNotIsWritable() ¶ public static
assertNotIsWritable(string $filename, string $message = '')Asserts that a file/dir exists and is not writable.
Parameters
- 
                string$filename
- 
                string$message optional
assertNotNull() ¶ public static
assertNotNull(mixed $actual, string $message = '')Asserts that a variable is not null.
Parameters
- 
                mixed$actual
- 
                string$message optional
assertNotRegExp() ¶ public static
assertNotRegExp(string $pattern, string $string, string $message = '')Asserts that a string does not match a given regular expression.
Parameters
- 
                string$pattern
- 
                string$string
- 
                string$message optional
assertNotSame() ¶ public static
assertNotSame(mixed $expected, mixed $actual, string $message = '')Asserts that two variables do not have the same type and value. Used on objects, it asserts that two variables do not reference the same object.
Parameters
- 
                mixed$expected
- 
                mixed$actual
- 
                string$message optional
assertNotSameSize() ¶ public static
assertNotSameSize(array|Countable|Traversable $expected, array|Countable|Traversable $actual, string $message = '')Assert that the size of two arrays (or Countable or Traversable objects)
is not the same.
Parameters
- 
                array|Countable|Traversable$expected
- 
                array|Countable|Traversable$actual
- 
                string$message optional
assertNotTrue() ¶ public static
assertNotTrue(bool $condition, string $message = '')Asserts that a condition is not true.
Parameters
- 
                bool$condition
- 
                string$message optional
Throws
PHPUnit_Framework_AssertionFailedErrorassertNotWithinRange() ¶ protected static
assertNotWithinRange(float $expected, float $result, float $margin, string $message = ''): voidCompatibility function to test if a value is not between an acceptable range.
Parameters
- 
                float$expected
- 
                float$result
- 
                float$margin
- the rage of acceptation 
- 
                string$message optional
- the text to display if the assertion is not correct 
Returns
voidassertNull() ¶ public static
assertNull(mixed $actual, string $message = '')Asserts that a variable is null.
Parameters
- 
                mixed$actual
- 
                string$message optional
assertObjectHasAttribute() ¶ public static
assertObjectHasAttribute(string $attributeName, object $object, string $message = '')Asserts that an object has a specified attribute.
Parameters
- 
                string$attributeName
- 
                object$object
- 
                string$message optional
assertObjectNotHasAttribute() ¶ public static
assertObjectNotHasAttribute(string $attributeName, object $object, string $message = '')Asserts that an object does not have a specified attribute.
Parameters
- 
                string$attributeName
- 
                object$object
- 
                string$message optional
assertPathEquals() ¶ protected static
assertPathEquals(string $expected, string $result, string $message = ''): voidCompatibility function to test paths.
Parameters
- 
                string$expected
- 
                string$result
- 
                string$message optional
- the text to display if the assertion is not correct 
Returns
voidassertPostConditions() ¶ protected
assertPostConditions()Performs assertions shared by all tests of a test case.
This method is called after the execution of a test ends and before tearDown() is called.
assertPreConditions() ¶ protected
assertPreConditions()Performs assertions shared by all tests of a test case.
This method is called before the execution of a test starts and after setUp() is called.
assertRedirect() ¶ public
assertRedirect(string|array|null $url = null, string $message = ''): voidAsserts that the Location header is correct.
Parameters
- 
                string|array|null$url optional
- The URL you expected the client to go to. This can either be a string URL or an array compatible with Router::url(). Use null to simply check for the existence of this header. 
- 
                string$message optional
- The failure message that will be appended to the generated message. 
Returns
voidassertRedirectContains() ¶ public
assertRedirectContains(string $url, string $message = ''): voidAsserts that the Location header contains a substring
Parameters
- 
                string$url
- The URL you expected the client to go to. 
- 
                string$message optional
- The failure message that will be appended to the generated message. 
Returns
voidassertRegExp() ¶ public static
assertRegExp(string $pattern, string $string, string $message = '')Asserts that a string matches a given regular expression.
Parameters
- 
                string$pattern
- 
                string$string
- 
                string$message optional
assertResponseCode() ¶ public
assertResponseCode(int $code): voidAsserts a specific response status code.
Parameters
- 
                int$code
- Status code to assert. 
Returns
voidassertResponseContains() ¶ public
assertResponseContains(string $content, string $message = ''): voidAsserts content exists in the response body.
Parameters
- 
                string$content
- The content to check for. 
- 
                string$message optional
- The failure message that will be appended to the generated message. 
Returns
voidassertResponseEmpty() ¶ public
assertResponseEmpty(string $message = ''): voidAssert response content is empty.
Parameters
- 
                string$message optional
- The failure message that will be appended to the generated message. 
Returns
voidassertResponseEquals() ¶ public
assertResponseEquals(mixed $content, string $message = ''): voidAsserts content exists in the response body.
Parameters
- 
                mixed$content
- The content to check for. 
- 
                string$message optional
- The failure message that will be appended to the generated message. 
Returns
voidassertResponseError() ¶ public
assertResponseError(): voidAsserts that the response status code is in the 4xx range.
Returns
voidassertResponseFailure() ¶ public
assertResponseFailure(): voidAsserts that the response status code is in the 5xx range.
Returns
voidassertResponseNotContains() ¶ public
assertResponseNotContains(string $content, string $message = ''): voidAsserts content does not exist in the response body.
Parameters
- 
                string$content
- The content to check for. 
- 
                string$message optional
- The failure message that will be appended to the generated message. 
Returns
voidassertResponseNotEmpty() ¶ public
assertResponseNotEmpty(string $message = ''): voidAssert response content is not empty.
Parameters
- 
                string$message optional
- The failure message that will be appended to the generated message. 
Returns
voidassertResponseNotRegExp() ¶ public
assertResponseNotRegExp(string $pattern, string $message = ''): voidAsserts that the response body does not match a given regular expression.
Parameters
- 
                string$pattern
- The pattern to compare against. 
- 
                string$message optional
- The failure message that will be appended to the generated message. 
Returns
voidassertResponseOk() ¶ public
assertResponseOk(): voidAsserts that the response status code is in the 2xx range.
Returns
voidassertResponseRegExp() ¶ public
assertResponseRegExp(string $pattern, string $message = ''): voidAsserts that the response body matches a given regular expression.
Parameters
- 
                string$pattern
- The pattern to compare against. 
- 
                string$message optional
- The failure message that will be appended to the generated message. 
Returns
voidassertResponseSuccess() ¶ public
assertResponseSuccess(): voidAsserts that the response status code is in the 2xx/3xx range.
Returns
voidassertSame() ¶ public static
assertSame(mixed $expected, mixed $actual, string $message = '')Asserts that two variables have the same type and value. Used on objects, it asserts that two variables reference the same object.
Parameters
- 
                mixed$expected
- 
                mixed$actual
- 
                string$message optional
assertSameSize() ¶ public static
assertSameSize(array|Countable|Traversable $expected, array|Countable|Traversable $actual, string $message = '')Assert that the size of two arrays (or Countable or Traversable objects)
is the same.
Parameters
- 
                array|Countable|Traversable$expected
- 
                array|Countable|Traversable$actual
- 
                string$message optional
assertSession() ¶ public
assertSession(string $expected, string $path, string $message = ''): voidAsserts session contents
Parameters
- 
                string$expected
- The expected contents. 
- 
                string$path
- The session data path. Uses Hash::get() compatible notation 
- 
                string$message optional
- The failure message that will be appended to the generated message. 
Returns
voidassertStringEndsNotWith() ¶ public static
assertStringEndsNotWith(string $suffix, string $string, string $message = '')Asserts that a string ends not with a given suffix.
Parameters
- 
                string$suffix
- 
                string$string
- 
                string$message optional
assertStringEndsWith() ¶ public static
assertStringEndsWith(string $suffix, string $string, string $message = '')Asserts that a string ends with a given suffix.
Parameters
- 
                string$suffix
- 
                string$string
- 
                string$message optional
assertStringEqualsFile() ¶ public static
assertStringEqualsFile(string $expectedFile, string $actualString, string $message = '', bool $canonicalize = false, bool $ignoreCase = false)Asserts that the contents of a string is equal to the contents of a file.
Parameters
- 
                string$expectedFile
- 
                string$actualString
- 
                string$message optional
- 
                bool$canonicalize optional
- 
                bool$ignoreCase optional
assertStringMatchesFormat() ¶ public static
assertStringMatchesFormat(string $format, string $string, string $message = '')Asserts that a string matches a given format string.
Parameters
- 
                string$format
- 
                string$string
- 
                string$message optional
assertStringMatchesFormatFile() ¶ public static
assertStringMatchesFormatFile(string $formatFile, string $string, string $message = '')Asserts that a string matches a given format file.
Parameters
- 
                string$formatFile
- 
                string$string
- 
                string$message optional
assertStringNotEqualsFile() ¶ public static
assertStringNotEqualsFile(string $expectedFile, string $actualString, string $message = '', bool $canonicalize = false, bool $ignoreCase = false)Asserts that the contents of a string is not equal to the contents of a file.
Parameters
- 
                string$expectedFile
- 
                string$actualString
- 
                string$message optional
- 
                bool$canonicalize optional
- 
                bool$ignoreCase optional
assertStringNotMatchesFormat() ¶ public static
assertStringNotMatchesFormat(string $format, string $string, string $message = '')Asserts that a string does not match a given format string.
Parameters
- 
                string$format
- 
                string$string
- 
                string$message optional
assertStringNotMatchesFormatFile() ¶ public static
assertStringNotMatchesFormatFile(string $formatFile, string $string, string $message = '')Asserts that a string does not match a given format string.
Parameters
- 
                string$formatFile
- 
                string$string
- 
                string$message optional
assertStringStartsNotWith() ¶ public static
assertStringStartsNotWith(string $prefix, string $string, string $message = '')Asserts that a string starts not with a given prefix.
Parameters
- 
                string$prefix
- 
                string$string
- 
                string$message optional
assertStringStartsWith() ¶ public static
assertStringStartsWith(string $prefix, string $string, string $message = '')Asserts that a string starts with a given prefix.
Parameters
- 
                string$prefix
- 
                string$string
- 
                string$message optional
assertTags() ¶ public
assertTags(string $string, array $expected, bool $fullDebug = false): voidAsserts HTML tags.
Parameters
- 
                string$string
- An HTML/XHTML/XML string 
- 
                array$expected
- An array, see above 
- 
                bool$fullDebug optional
- Whether or not more verbose output should be used. 
Returns
voidassertTemplate() ¶ public
assertTemplate(string $content, string $message = ''): voidAsserts that the search string was in the template name.
Parameters
- 
                string$content
- The content to check for. 
- 
                string$message optional
- The failure message that will be appended to the generated message. 
Returns
voidassertTextContains() ¶ public
assertTextContains(string $needle, string $haystack, string $message = '', bool $ignoreCase = false): voidAssert that a string contains another string, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
Parameters
- 
                string$needle
- The string to search for. 
- 
                string$haystack
- The string to search through. 
- 
                string$message optional
- The message to display on failure. 
- 
                bool$ignoreCase optional
- Whether or not the search should be case-sensitive. 
Returns
voidassertTextEndsNotWith() ¶ public
assertTextEndsNotWith(string $suffix, string $string, string $message = ''): voidAsserts that a string ends not with a given prefix, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
Parameters
- 
                string$suffix
- The suffix to not find. 
- 
                string$string
- The string to search. 
- 
                string$message optional
- The message to use for failure. 
Returns
voidassertTextEndsWith() ¶ public
assertTextEndsWith(string $suffix, string $string, string $message = ''): voidAsserts that a string ends with a given prefix, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
Parameters
- 
                string$suffix
- The suffix to find. 
- 
                string$string
- The string to search. 
- 
                string$message optional
- The message to use for failure. 
Returns
voidassertTextEquals() ¶ public
assertTextEquals(string $expected, string $result, string $message = ''): voidAssert text equality, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
Parameters
- 
                string$expected
- The expected value. 
- 
                string$result
- The actual value. 
- 
                string$message optional
- The message to use for failure. 
Returns
voidassertTextNotContains() ¶ public
assertTextNotContains(string $needle, string $haystack, string $message = '', bool $ignoreCase = false): voidAssert that a text doesn't contain another text, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
Parameters
- 
                string$needle
- The string to search for. 
- 
                string$haystack
- The string to search through. 
- 
                string$message optional
- The message to display on failure. 
- 
                bool$ignoreCase optional
- Whether or not the search should be case-sensitive. 
Returns
voidassertTextNotEquals() ¶ public
assertTextNotEquals(string $expected, string $result, string $message = ''): voidAssert text equality, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
Parameters
- 
                string$expected
- The expected value. 
- 
                string$result
- The actual value. 
- 
                string$message optional
- The message to use for failure. 
Returns
voidassertTextStartsNotWith() ¶ public
assertTextStartsNotWith(string $prefix, string $string, string $message = ''): voidAsserts that a string starts not with a given prefix, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
Parameters
- 
                string$prefix
- The prefix to not find. 
- 
                string$string
- The string to search. 
- 
                string$message optional
- The message to use for failure. 
Returns
voidassertTextStartsWith() ¶ public
assertTextStartsWith(string $prefix, string $string, string $message = ''): voidAsserts that a string starts with a given prefix, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
Parameters
- 
                string$prefix
- The prefix to check for. 
- 
                string$string
- The string to search in. 
- 
                string$message optional
- The message to use for failure. 
Returns
voidassertThat() ¶ public static
assertThat(mixed $value, PHPUnit_Framework_Constraint $constraint, string $message = '')Evaluates a PHPUnit_Framework_Constraint matcher object.
Parameters
- 
                mixed$value
- 
                PHPUnit_Framework_Constraint$constraint
- 
                string$message optional
assertTrue() ¶ public static
assertTrue(bool $condition, string $message = '')Asserts that a condition is true.
Parameters
- 
                bool$condition
- 
                string$message optional
Throws
PHPUnit_Framework_AssertionFailedErrorassertWithinRange() ¶ protected static
assertWithinRange(float $expected, float $result, float $margin, string $message = ''): voidCompatibility function to test if a value is between an acceptable range.
Parameters
- 
                float$expected
- 
                float$result
- 
                float$margin
- the rage of acceptation 
- 
                string$message optional
- the text to display if the assertion is not correct 
Returns
voidassertXmlFileEqualsXmlFile() ¶ public static
assertXmlFileEqualsXmlFile(string $expectedFile, string $actualFile, string $message = '')Asserts that two XML files are equal.
Parameters
- 
                string$expectedFile
- 
                string$actualFile
- 
                string$message optional
assertXmlFileNotEqualsXmlFile() ¶ public static
assertXmlFileNotEqualsXmlFile(string $expectedFile, string $actualFile, string $message = '')Asserts that two XML files are not equal.
Parameters
- 
                string$expectedFile
- 
                string$actualFile
- 
                string$message optional
assertXmlStringEqualsXmlFile() ¶ public static
assertXmlStringEqualsXmlFile(string $expectedFile, string $actualXml, string $message = '')Asserts that two XML documents are equal.
Parameters
- 
                string$expectedFile
- 
                string$actualXml
- 
                string$message optional
assertXmlStringEqualsXmlString() ¶ public static
assertXmlStringEqualsXmlString(string $expectedXml, string $actualXml, string $message = '')Asserts that two XML documents are equal.
Parameters
- 
                string$expectedXml
- 
                string$actualXml
- 
                string$message optional
assertXmlStringNotEqualsXmlFile() ¶ public static
assertXmlStringNotEqualsXmlFile(string $expectedFile, string $actualXml, string $message = '')Asserts that two XML documents are not equal.
Parameters
- 
                string$expectedFile
- 
                string$actualXml
- 
                string$message optional
assertXmlStringNotEqualsXmlString() ¶ public static
assertXmlStringNotEqualsXmlString(string $expectedXml, string $actualXml, string $message = '')Asserts that two XML documents are not equal.
Parameters
- 
                string$expectedXml
- 
                string$actualXml
- 
                string$message optional
at() ¶ public static
at(int $index): PHPUnit_Framework_MockObject_Matcher_InvokedAtIndexReturns a matcher that matches when the method is executed at the given index.
Parameters
- 
                int$index
Returns
PHPUnit_Framework_MockObject_Matcher_InvokedAtIndexatLeast() ¶ public static
atLeast(int $requiredInvocations): PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastCountReturns a matcher that matches when the method is executed at least N times.
Parameters
- 
                int$requiredInvocations
Returns
PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastCountatLeastOnce() ¶ public static
atLeastOnce(): PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastOnceReturns a matcher that matches when the method is executed at least once.
Returns
PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastOnceatMost() ¶ public static
atMost(int $allowedInvocations): PHPUnit_Framework_MockObject_Matcher_InvokedAtMostCountReturns a matcher that matches when the method is executed at most N times.
Parameters
- 
                int$allowedInvocations
Returns
PHPUnit_Framework_MockObject_Matcher_InvokedAtMostCountattribute() ¶ public static
attribute(PHPUnit_Framework_Constraint $constraint, string $attributeName): PHPUnit_Framework_Constraint_AttributeReturns a PHPUnit_Framework_Constraint_Attribute matcher object.
Parameters
- 
                PHPUnit_Framework_Constraint$constraint
- 
                string$attributeName
Returns
PHPUnit_Framework_Constraint_AttributeattributeEqualTo() ¶ public static
attributeEqualTo(string $attributeName, mixed $value, float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): PHPUnit_Framework_Constraint_AttributeReturns a PHPUnit_Framework_Constraint_IsEqual matcher object that is wrapped in a PHPUnit_Framework_Constraint_Attribute matcher object.
Parameters
- 
                string$attributeName
- 
                mixed$value
- 
                float$delta optional
- 
                int$maxDepth optional
- 
                bool$canonicalize optional
- 
                bool$ignoreCase optional
Returns
PHPUnit_Framework_Constraint_Attributecallback() ¶ public static
callback(callable $callback): PHPUnit_Framework_Constraint_CallbackReturns a PHPUnit_Framework_Constraint_Callback matcher object.
Parameters
- 
                callable$callback
Returns
PHPUnit_Framework_Constraint_CallbackclassHasAttribute() ¶ public static
classHasAttribute(string $attributeName): PHPUnit_Framework_Constraint_ClassHasAttributeReturns a PHPUnit_Framework_Constraint_ClassHasAttribute matcher object.
Parameters
- 
                string$attributeName
Returns
PHPUnit_Framework_Constraint_ClassHasAttributeclassHasStaticAttribute() ¶ public static
classHasStaticAttribute(string $attributeName): PHPUnit_Framework_Constraint_ClassHasStaticAttributeReturns a PHPUnit_Framework_Constraint_ClassHasStaticAttribute matcher object.
Parameters
- 
                string$attributeName
Returns
PHPUnit_Framework_Constraint_ClassHasStaticAttributeconfigApplication() ¶ public
configApplication(string $class, array|null $constructorArgs): voidConfigure the application class to use in integration tests.
Combined with useHttpServer() to customize the class name and constructor arguments
of your application class.
Parameters
- 
                string$class
- The application class name. 
- 
                array|null$constructorArgs
- The constructor arguments for your application class. 
Returns
voidconfigRequest() ¶ public
configRequest(array $data): voidConfigures the data for the next request.
This data is cleared in the tearDown() method.
You can call this method multiple times to append into the current state.
Parameters
- 
                array$data
- The request data to use. 
Returns
voidcontains() ¶ public static
contains(mixed $value, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): PHPUnit_Framework_Constraint_TraversableContainsReturns a PHPUnit_Framework_Constraint_TraversableContains matcher object.
Parameters
- 
                mixed$value
- 
                bool$checkForObjectIdentity optional
- 
                bool$checkForNonObjectIdentity optional
Returns
PHPUnit_Framework_Constraint_TraversableContainscontainsOnly() ¶ public static
containsOnly(string $type): PHPUnit_Framework_Constraint_TraversableContainsOnlyReturns a PHPUnit_Framework_Constraint_TraversableContainsOnly matcher object.
Parameters
- 
                string$type
Returns
PHPUnit_Framework_Constraint_TraversableContainsOnlycontainsOnlyInstancesOf() ¶ public static
containsOnlyInstancesOf(string $classname): PHPUnit_Framework_Constraint_TraversableContainsOnlyReturns a PHPUnit_Framework_Constraint_TraversableContainsOnly matcher object.
Parameters
- 
                string$classname
Returns
PHPUnit_Framework_Constraint_TraversableContainsOnlycontrollerSpy() ¶ public
controllerSpy(Cake\Event\Event $event, Cake\Controller\Controller|null $controller = null): voidAdds additional event spies to the controller/view event manager.
Parameters
- 
                Cake\Event\Event$event
- A dispatcher event. 
- 
                Cake\Controller\Controller|null$controller optional
- Controller instance. 
Returns
voidcookie() ¶ public
cookie(string $name, mixed $value): voidSets a request cookie for future requests.
This method lets you configure the session data you want to be used for requests that follow. The session state is reset in each tearDown().
You can call this method multiple times to append into the current state.
Parameters
- 
                string$name
- The cookie name to use. 
- 
                mixed$value
- The value of the cookie. 
Returns
voidcookieEncrypted() ¶ public
cookieEncrypted(string $name, mixed $value, string|bool $encrypt = 'aes', string|null $key = null): voidSets a encrypted request cookie for future requests.
The difference from cookie() is this encrypts the cookie value like the CookieComponent.
Parameters
- 
                string$name
- The cookie name to use. 
- 
                mixed$value
- The value of the cookie. 
- 
                string|bool$encrypt optional
- Encryption mode to use. 
- 
                string|null$key optional
- Encryption key used. Defaults to Security.salt. 
Returns
voidSee Also
count() ¶ public
count(): intCounts the number of test cases executed by run(TestResult result).
Returns
intcountOf() ¶ public static
countOf(int $count): PHPUnit_Framework_Constraint_CountReturns a PHPUnit_Framework_Constraint_Count matcher object.
Parameters
- 
                int$count
Returns
PHPUnit_Framework_Constraint_CountcreateConfiguredMock() ¶ protected
createConfiguredMock(string $originalClassName, array $configuration): PHPUnit_Framework_MockObject_MockObjectReturns a configured test double for the specified class.
Parameters
- 
                string$originalClassName
- 
                array$configuration
Returns
PHPUnit_Framework_MockObject_MockObjectThrows
PHPUnit_Framework_ExceptioncreateMock() ¶ protected
createMock(string $originalClassName): PHPUnit_Framework_MockObject_MockObjectReturns a test double for the specified class.
Parameters
- 
                string$originalClassName
Returns
PHPUnit_Framework_MockObject_MockObjectThrows
PHPUnit_Framework_ExceptioncreatePartialMock() ¶ protected
createPartialMock(string $originalClassName, array $methods): PHPUnit_Framework_MockObject_MockObjectReturns a partial test double for the specified class.
Parameters
- 
                string$originalClassName
- 
                array$methods
Returns
PHPUnit_Framework_MockObject_MockObjectThrows
PHPUnit_Framework_ExceptioncreateResult() ¶ protected
createResult(): PHPUnit_Framework_TestResultCreates a default TestResult object.
Returns
PHPUnit_Framework_TestResultdelete() ¶ public
delete(string|array $url): voidPerforms a DELETE request using the current request data.
The response of the dispatched request will be stored as a property. You can use various assert methods to check the response.
Parameters
- 
                string|array$url
- The URL to request. 
Returns
voiddirectoryExists() ¶ public static
directoryExists(): PHPUnit_Framework_Constraint_DirectoryExistsReturns a PHPUnit_Framework_Constraint_DirectoryExists matcher object.
Returns
PHPUnit_Framework_Constraint_DirectoryExistsenableCsrfToken() ¶ public
enableCsrfToken(): voidCalling this method will add a CSRF token to the request.
Both the POST data and cookie will be populated when this option is enabled. The default parameter names will be used.
Returns
voidenableSecurityToken() ¶ public
enableSecurityToken(): voidCalling this method will enable a SecurityComponent compatible token to be added to request data. This lets you easily test actions protected by SecurityComponent.
Returns
voidequalTo() ¶ public static
equalTo(mixed $value, float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): PHPUnit_Framework_Constraint_IsEqualReturns a PHPUnit_Framework_Constraint_IsEqual matcher object.
Parameters
- 
                mixed$value
- 
                float$delta optional
- 
                int$maxDepth optional
- 
                bool$canonicalize optional
- 
                bool$ignoreCase optional
Returns
PHPUnit_Framework_Constraint_IsEqualexactly() ¶ public static
exactly(int $count): PHPUnit_Framework_MockObject_Matcher_InvokedCountReturns a matcher that matches when the method is executed exactly $count times.
Parameters
- 
                int$count
Returns
PHPUnit_Framework_MockObject_Matcher_InvokedCountexpectExceptionCode() ¶ public
expectExceptionCode(int|string $code)Parameters
- 
                int|string$code
Throws
PHPUnit_Framework_ExceptionexpectExceptionMessage() ¶ public
expectExceptionMessage(string $message)Parameters
- 
                string$message
Throws
PHPUnit_Framework_ExceptionexpectExceptionMessageRegExp() ¶ public
expectExceptionMessageRegExp(string $messageRegExp)Parameters
- 
                string$messageRegExp
Throws
PHPUnit_Framework_ExceptionexpectOutputRegex() ¶ public
expectOutputRegex(string $expectedRegex)Parameters
- 
                string$expectedRegex
Throws
PHPUnit_Framework_ExceptionexpectOutputString() ¶ public
expectOutputString(string $expectedString)Parameters
- 
                string$expectedString
fail() ¶ public static
fail(string $message = '')Fails a test with the given message.
Parameters
- 
                string$message optional
Throws
PHPUnit_Framework_AssertionFailedErrorfileExists() ¶ public static
fileExists(): PHPUnit_Framework_Constraint_FileExistsReturns a PHPUnit_Framework_Constraint_FileExists matcher object.
Returns
PHPUnit_Framework_Constraint_FileExistsget() ¶ public
get(string|array $url): voidPerforms a GET request using the current request data.
The response of the dispatched request will be stored as a property. You can use various assert methods to check the response.
Parameters
- 
                string|array$url
- The URL to request. 
Returns
voidgetAnnotations() ¶ public
getAnnotations(): arrayReturns the annotations for this test.
Returns
arraygetDataSetAsString() ¶ protected
getDataSetAsString(bool $includeData = true): stringGets the data set description of a TestCase.
Parameters
- 
                bool$includeData optional
Returns
stringgetMock() ¶ protected
getMock(string $originalClassName, array|null $methods = [], array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, bool $cloneArguments = false, bool $callOriginalMethods = false, object $proxyTarget = null): PHPUnit_Framework_MockObject_MockObjectReturns a mock object for the specified class.
Parameters
- 
                string$originalClassName
- Name of the class to mock. 
- 
                array|null$methods optional
- When provided, only methods whose names are in the array are replaced with a configurable test double. The behavior of the other methods is not changed. Providing null means that no methods will be replaced. 
- 
                array$arguments optional
- Parameters to pass to the original class' constructor. 
- 
                string$mockClassName optional
- Class name for the generated test double class. 
- 
                bool$callOriginalConstructor optional
- Can be used to disable the call to the original class' constructor. 
- 
                bool$callOriginalClone optional
- Can be used to disable the call to the original class' clone constructor. 
- 
                bool$callAutoload optional
- Can be used to disable __autoload() during the generation of the test double class. 
- 
                bool$cloneArguments optional
- 
                bool$callOriginalMethods optional
- 
                object$proxyTarget optional
Returns
PHPUnit_Framework_MockObject_MockObjectThrows
PHPUnit_Framework_ExceptiongetMockBuilder() ¶ public
getMockBuilder(string|string[] $className): PHPUnit_Framework_MockObject_MockBuilderReturns a builder object to create mock objects using a fluent interface.
Parameters
- 
                string|string[]$className
Returns
PHPUnit_Framework_MockObject_MockBuildergetMockClass() ¶ protected
getMockClass(string $originalClassName, array $methods = [], array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = false, bool $callOriginalClone = true, bool $callAutoload = true, bool $cloneArguments = false): stringMocks the specified class and returns the name of the mocked class.
Parameters
- 
                string$originalClassName
- 
                array$methods optional
- 
                array$arguments optional
- 
                string$mockClassName optional
- 
                bool$callOriginalConstructor optional
- 
                bool$callOriginalClone optional
- 
                bool$callAutoload optional
- 
                bool$cloneArguments optional
Returns
stringThrows
PHPUnit_Framework_ExceptiongetMockForAbstractClass() ¶ protected
getMockForAbstractClass(string $originalClassName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, array $mockedMethods = [], bool $cloneArguments = false): PHPUnit_Framework_MockObject_MockObjectReturns a mock object for the specified abstract class with all abstract methods of the class mocked. Concrete methods are not mocked by default. To mock concrete methods, use the 7th parameter ($mockedMethods).
Parameters
- 
                string$originalClassName
- 
                array$arguments optional
- 
                string$mockClassName optional
- 
                bool$callOriginalConstructor optional
- 
                bool$callOriginalClone optional
- 
                bool$callAutoload optional
- 
                array$mockedMethods optional
- 
                bool$cloneArguments optional
Returns
PHPUnit_Framework_MockObject_MockObjectThrows
PHPUnit_Framework_ExceptiongetMockForModel() ¶ public
getMockForModel(string $alias, mixed $methods = [], array $options = []): Cake\ORM\Table|PHPUnit_Framework_MockObject_MockObjectMock a model, maintain fixtures and table association
Parameters
- 
                string$alias
- The model to get a mock for. 
- 
                mixed$methods optional
- The list of methods to mock 
- 
                array$options optional
- The config data for the mock's constructor. 
Returns
Cake\ORM\Table|PHPUnit_Framework_MockObject_MockObjectThrows
Cake\ORM\Exception\MissingTableClassExceptiongetMockForTrait() ¶ protected
getMockForTrait(string $traitName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, array $mockedMethods = [], bool $cloneArguments = false): PHPUnit_Framework_MockObject_MockObjectReturns 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.
Parameters
- 
                string$traitName
- 
                array$arguments optional
- 
                string$mockClassName optional
- 
                bool$callOriginalConstructor optional
- 
                bool$callOriginalClone optional
- 
                bool$callAutoload optional
- 
                array$mockedMethods optional
- 
                bool$cloneArguments optional
Returns
PHPUnit_Framework_MockObject_MockObjectThrows
PHPUnit_Framework_ExceptiongetMockFromWsdl() ¶ protected
getMockFromWsdl(string $wsdlFile, string $originalClassName = '', string $mockClassName = '', array $methods = [], bool $callOriginalConstructor = true, array $options = []): PHPUnit_Framework_MockObject_MockObjectReturns a mock object based on the given WSDL file.
Parameters
- 
                string$wsdlFile
- 
                string$originalClassName optional
- 
                string$mockClassName optional
- 
                array$methods optional
- 
                bool$callOriginalConstructor optional
- 
                array$options optional
- An array of options passed to SOAPClient::_construct 
Returns
PHPUnit_Framework_MockObject_MockObjectgetMockObjectGenerator() ¶ protected
getMockObjectGenerator(): PHPUnit_Framework_MockObject_GeneratorGet the mock object generator, creating it if it doesn't exist.
Returns
PHPUnit_Framework_MockObject_GeneratorgetMockWithoutInvokingTheOriginalConstructor() ¶ protected
getMockWithoutInvokingTheOriginalConstructor(string $originalClassName): PHPUnit_Framework_MockObject_MockObjectReturns a mock with disabled constructor object for the specified class.
Parameters
- 
                string$originalClassName
Returns
PHPUnit_Framework_MockObject_MockObjectThrows
PHPUnit_Framework_ExceptiongetName() ¶ public
getName(bool $withDataSet = true): stringGets the name of a TestCase.
Parameters
- 
                bool$withDataSet optional
Returns
stringgetNumAssertions() ¶ public
getNumAssertions(): intReturns the number of assertions performed by this test.
Returns
intgetObjectAttribute() ¶ public static
getObjectAttribute(object $object, string $attributeName): mixedReturns the value of an object's attribute. This also works for attributes that are declared protected or private.
Parameters
- 
                object$object
- 
                string$attributeName
Returns
mixedThrows
PHPUnit_Framework_ExceptiongetObjectForTrait() ¶ protected
getObjectForTrait(string $traitName, array $arguments = [], string $traitClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, bool $cloneArguments = false): objectReturns an object for the specified trait.
Parameters
- 
                string$traitName
- 
                array$arguments optional
- 
                string$traitClassName optional
- 
                bool$callOriginalConstructor optional
- 
                bool$callOriginalClone optional
- 
                bool$callAutoload optional
- 
                bool$cloneArguments optional
Returns
objectThrows
PHPUnit_Framework_ExceptiongetProvidedData() ¶ protected
getProvidedData(): arrayGets the data set of a TestCase.
Returns
arraygetStaticAttribute() ¶ public static
getStaticAttribute(string $className, string $attributeName): mixedReturns the value of a static attribute. This also works for attributes that are declared protected or private.
Parameters
- 
                string$className
- 
                string$attributeName
Returns
mixedThrows
PHPUnit_Framework_ExceptiongetStatusMessage() ¶ public
getStatusMessage(): stringReturns the status message of this test.
Returns
stringgetTestResultObject() ¶ public
getTestResultObject(): PHPUnit_Framework_TestResultReturns
PHPUnit_Framework_TestResultgreaterThan() ¶ public static
greaterThan(mixed $value): PHPUnit_Framework_Constraint_GreaterThanReturns a PHPUnit_Framework_Constraint_GreaterThan matcher object.
Parameters
- 
                mixed$value
Returns
PHPUnit_Framework_Constraint_GreaterThangreaterThanOrEqual() ¶ public static
greaterThanOrEqual(mixed $value): PHPUnit_Framework_Constraint_OrReturns a PHPUnit_Framework_Constraint_Or matcher object that wraps a PHPUnit_Framework_Constraint_IsEqual and a PHPUnit_Framework_Constraint_GreaterThan matcher object.
Parameters
- 
                mixed$value
Returns
PHPUnit_Framework_Constraint_OrhasDependencies() ¶ public
hasDependencies(): boolReturns true if the tests has dependencies
Returns
boolidenticalTo() ¶ public static
identicalTo(mixed $value): PHPUnit_Framework_Constraint_IsIdenticalReturns a PHPUnit_Framework_Constraint_IsIdentical matcher object.
Parameters
- 
                mixed$value
Returns
PHPUnit_Framework_Constraint_IsIdenticaliniSet() ¶ protected
iniSet(string $varName, string $newValue)This method is a wrapper for the ini_set() function that automatically resets the modified php.ini setting to its original value after the test is run.
Parameters
- 
                string$varName
- 
                string$newValue
Throws
PHPUnit_Framework_ExceptionisEmpty() ¶ public static
isEmpty(): PHPUnit_Framework_Constraint_IsEmptyReturns a PHPUnit_Framework_Constraint_IsEmpty matcher object.
Returns
PHPUnit_Framework_Constraint_IsEmptyisFalse() ¶ public static
isFalse(): PHPUnit_Framework_Constraint_IsFalseReturns a PHPUnit_Framework_Constraint_IsFalse matcher object.
Returns
PHPUnit_Framework_Constraint_IsFalseisFinite() ¶ public static
isFinite(): PHPUnit_Framework_Constraint_IsFiniteReturns a PHPUnit_Framework_Constraint_IsFinite matcher object.
Returns
PHPUnit_Framework_Constraint_IsFiniteisInfinite() ¶ public static
isInfinite(): PHPUnit_Framework_Constraint_IsInfiniteReturns a PHPUnit_Framework_Constraint_IsInfinite matcher object.
Returns
PHPUnit_Framework_Constraint_IsInfiniteisInstanceOf() ¶ public static
isInstanceOf(string $className): PHPUnit_Framework_Constraint_IsInstanceOfReturns a PHPUnit_Framework_Constraint_IsInstanceOf matcher object.
Parameters
- 
                string$className
Returns
PHPUnit_Framework_Constraint_IsInstanceOfisJson() ¶ public static
isJson(): PHPUnit_Framework_Constraint_IsJsonReturns a PHPUnit_Framework_Constraint_IsJson matcher object.
Returns
PHPUnit_Framework_Constraint_IsJsonisNan() ¶ public static
isNan(): PHPUnit_Framework_Constraint_IsNanReturns a PHPUnit_Framework_Constraint_IsNan matcher object.
Returns
PHPUnit_Framework_Constraint_IsNanisNull() ¶ public static
isNull(): PHPUnit_Framework_Constraint_IsNullReturns a PHPUnit_Framework_Constraint_IsNull matcher object.
Returns
PHPUnit_Framework_Constraint_IsNullisReadable() ¶ public static
isReadable(): PHPUnit_Framework_Constraint_IsReadableReturns a PHPUnit_Framework_Constraint_IsReadable matcher object.
Returns
PHPUnit_Framework_Constraint_IsReadableisTrue() ¶ public static
isTrue(): PHPUnit_Framework_Constraint_IsTrueReturns a PHPUnit_Framework_Constraint_IsTrue matcher object.
Returns
PHPUnit_Framework_Constraint_IsTrueisType() ¶ public static
isType(string $type): PHPUnit_Framework_Constraint_IsTypeReturns a PHPUnit_Framework_Constraint_IsType matcher object.
Parameters
- 
                string$type
Returns
PHPUnit_Framework_Constraint_IsTypeisWritable() ¶ public static
isWritable(): PHPUnit_Framework_Constraint_IsWritableReturns a PHPUnit_Framework_Constraint_IsWritable matcher object.
Returns
PHPUnit_Framework_Constraint_IsWritablelessThan() ¶ public static
lessThan(mixed $value): PHPUnit_Framework_Constraint_LessThanReturns a PHPUnit_Framework_Constraint_LessThan matcher object.
Parameters
- 
                mixed$value
Returns
PHPUnit_Framework_Constraint_LessThanlessThanOrEqual() ¶ public static
lessThanOrEqual(mixed $value): PHPUnit_Framework_Constraint_OrReturns a PHPUnit_Framework_Constraint_Or matcher object that wraps a PHPUnit_Framework_Constraint_IsEqual and a PHPUnit_Framework_Constraint_LessThan matcher object.
Parameters
- 
                mixed$value
Returns
PHPUnit_Framework_Constraint_OrloadFixtures() ¶ public
loadFixtures(): voidChooses which fixtures to load for a given test
Each parameter is a model name that corresponds to a fixture, i.e. 'Posts', 'Authors', etc.
Returns
voidThrows
Exceptionwhen no fixture manager is available.
See Also
logicalAnd() ¶ public static
logicalAnd(): PHPUnit_Framework_Constraint_AndReturns a PHPUnit_Framework_Constraint_And matcher object.
Returns
PHPUnit_Framework_Constraint_AndlogicalNot() ¶ public static
logicalNot(PHPUnit_Framework_Constraint $constraint): PHPUnit_Framework_Constraint_NotReturns a PHPUnit_Framework_Constraint_Not matcher object.
Parameters
- 
                PHPUnit_Framework_Constraint$constraint
Returns
PHPUnit_Framework_Constraint_NotlogicalOr() ¶ public static
logicalOr(): PHPUnit_Framework_Constraint_OrReturns a PHPUnit_Framework_Constraint_Or matcher object.
Returns
PHPUnit_Framework_Constraint_OrlogicalXor() ¶ public static
logicalXor(): PHPUnit_Framework_Constraint_XorReturns a PHPUnit_Framework_Constraint_Xor matcher object.
Returns
PHPUnit_Framework_Constraint_XormarkTestIncomplete() ¶ public static
markTestIncomplete(string $message = '')Mark the test as incomplete.
Parameters
- 
                string$message optional
Throws
PHPUnit_Framework_IncompleteTestErrormarkTestSkipped() ¶ public static
markTestSkipped(string $message = '')Mark the test as skipped.
Parameters
- 
                string$message optional
Throws
PHPUnit_Framework_SkippedTestErrormatches() ¶ public static
matches(string $string): PHPUnit_Framework_Constraint_StringMatchesReturns a PHPUnit_Framework_Constraint_StringMatches matcher object.
Parameters
- 
                string$string
Returns
PHPUnit_Framework_Constraint_StringMatchesmatchesRegularExpression() ¶ public static
matchesRegularExpression(string $pattern): PHPUnit_Framework_Constraint_PCREMatchReturns a PHPUnit_Framework_Constraint_PCREMatch matcher object.
Parameters
- 
                string$pattern
Returns
PHPUnit_Framework_Constraint_PCREMatchnever() ¶ public static
never(): PHPUnit_Framework_MockObject_Matcher_InvokedCountReturns a matcher that matches when the method is never executed.
Returns
PHPUnit_Framework_MockObject_Matcher_InvokedCountobjectHasAttribute() ¶ public static
objectHasAttribute(string $attributeName): PHPUnit_Framework_Constraint_ObjectHasAttributeReturns a PHPUnit_Framework_Constraint_ObjectHasAttribute matcher object.
Parameters
- 
                string$attributeName
Returns
PHPUnit_Framework_Constraint_ObjectHasAttributeonConsecutiveCalls() ¶ public static
onConsecutiveCalls(): PHPUnit_Framework_MockObject_Stub_ConsecutiveCallsReturns
PHPUnit_Framework_MockObject_Stub_ConsecutiveCallsonNotSuccessfulTest() ¶ protected
onNotSuccessfulTest(Exception|Throwable $e)This method is called when a test method did not execute successfully.
Parameters
- 
                Exception|Throwable$e
Throws
Exception|Throwableonce() ¶ public static
once(): PHPUnit_Framework_MockObject_Matcher_InvokedCountReturns a matcher that matches when the method is executed exactly once.
Returns
PHPUnit_Framework_MockObject_Matcher_InvokedCountpatch() ¶ public
patch(string|array $url, array $data = []): voidPerforms a PATCH request using the current request data.
The response of the dispatched request will be stored as a property. You can use various assert methods to check the response.
Parameters
- 
                string|array$url
- The URL to request. 
- 
                array$data optional
- The data for the request. 
Returns
voidpost() ¶ public
post(string|array $url, array $data = []): voidPerforms a POST request using the current request data.
The response of the dispatched request will be stored as a property. You can use various assert methods to check the response.
Parameters
- 
                string|array$url
- The URL to request. 
- 
                array$data optional
- The data for the request. 
Returns
voidprepareTemplate() ¶ protected
prepareTemplate(Text_Template $template)Performs custom preparations on the process isolation template.
Parameters
- 
                Text_Template$template
prophesize() ¶ protected
prophesize(string|null $classOrInterface = null): Prophecy\Prophecy\ObjectProphecyParameters
- 
                string|null$classOrInterface optional
Returns
Prophecy\Prophecy\ObjectProphecyThrows
LogicExceptionput() ¶ public
put(string|array $url, array $data = []): voidPerforms a PUT request using the current request data.
The response of the dispatched request will be stored as a property. You can use various assert methods to check the response.
Parameters
- 
                string|array$url
- The URL to request. 
- 
                array$data optional
- The data for the request. 
Returns
voidreadAttribute() ¶ public static
readAttribute(string|object $classOrObject, string $attributeName): mixedReturns the value of an attribute of a class or an object. This also works for attributes that are declared protected or private.
Parameters
- 
                string|object$classOrObject
- 
                string$attributeName
Returns
mixedThrows
PHPUnit_Framework_ExceptionregisterMockObject() ¶ public
registerMockObject(PHPUnit_Framework_MockObject_MockObject $mockObject)Parameters
- 
                PHPUnit_Framework_MockObject_MockObject$mockObject
returnArgument() ¶ public static
returnArgument(int $argumentIndex): PHPUnit_Framework_MockObject_Stub_ReturnArgumentParameters
- 
                int$argumentIndex
Returns
PHPUnit_Framework_MockObject_Stub_ReturnArgumentreturnCallback() ¶ public static
returnCallback(mixed $callback): PHPUnit_Framework_MockObject_Stub_ReturnCallbackParameters
- 
                mixed$callback
Returns
PHPUnit_Framework_MockObject_Stub_ReturnCallbackreturnSelf() ¶ public static
returnSelf(): PHPUnit_Framework_MockObject_Stub_ReturnSelfReturns the current object.
This method is useful when mocking a fluent interface.
Returns
PHPUnit_Framework_MockObject_Stub_ReturnSelfreturnValue() ¶ public static
returnValue(mixed $value): PHPUnit_Framework_MockObject_Stub_ReturnParameters
- 
                mixed$value
Returns
PHPUnit_Framework_MockObject_Stub_ReturnreturnValueMap() ¶ public static
returnValueMap(array $valueMap): PHPUnit_Framework_MockObject_Stub_ReturnValueMapParameters
- 
                array$valueMap
Returns
PHPUnit_Framework_MockObject_Stub_ReturnValueMaprun() ¶ public
run(PHPUnit_Framework_TestResult $result = null): PHPUnit_Framework_TestResultRuns the test case and collects the results in a TestResult object. If no TestResult object is passed a new one will be created.
Parameters
- 
                PHPUnit_Framework_TestResult$result optional
Returns
PHPUnit_Framework_TestResultThrows
PHPUnit_Framework_ExceptionrunTest() ¶ protected
runTest(): mixedOverride to run the test and assert its state.
Returns
mixedThrows
Exception|PHPUnit_Framework_ExceptionPHPUnit_Framework_Exceptionsession() ¶ public
session(array $data): voidSets session data.
This method lets you configure the session data you want to be used for requests that follow. The session state is reset in each tearDown().
You can call this method multiple times to append into the current state.
Parameters
- 
                array$data
- The session data to use. 
Returns
voidsetBackupGlobals() ¶ public
setBackupGlobals(bool $backupGlobals)Calling this method in setUp() has no effect!
Parameters
- 
                bool$backupGlobals
setBackupStaticAttributes() ¶ public
setBackupStaticAttributes(bool $backupStaticAttributes)Calling this method in setUp() has no effect!
Parameters
- 
                bool$backupStaticAttributes
setBeStrictAboutChangesToGlobalState() ¶ public
setBeStrictAboutChangesToGlobalState(bool $beStrictAboutChangesToGlobalState)Parameters
- 
                bool$beStrictAboutChangesToGlobalState
setDependencies() ¶ public
setDependencies(array $dependencies)Sets the dependencies of a TestCase.
Parameters
- 
                array$dependencies
setDependencyInput() ¶ public
setDependencyInput(array $dependencyInput)Sets
Parameters
- 
                array$dependencyInput
setExpectedException() ¶ public
setExpectedException(mixed $exception, string $message = '', int|string $code = null)Parameters
- 
                mixed$exception
- 
                string$message optional
- Null means we do not check message at all, string (even empty) means we do. Default: null. 
- 
                int|string$code optional
- Null means we do not check code at all, non-null means we do. 
Throws
PHPUnit_Framework_ExceptionsetExpectedExceptionRegExp() ¶ public
setExpectedExceptionRegExp(mixed $exception, string $messageRegExp = '', int $code = null)Parameters
- 
                mixed$exception
- 
                string$messageRegExp optional
- 
                int$code optional
Throws
PHPUnit_Framework_ExceptionsetInIsolation() ¶ public
setInIsolation(bool $inIsolation)Parameters
- 
                bool$inIsolation
Throws
PHPUnit_Framework_ExceptionsetLocale() ¶ protected
setLocale()This method is a wrapper for the setlocale() function that automatically resets the locale to its original value after the test is run.
Throws
PHPUnit_Framework_ExceptionsetOutputCallback() ¶ public
setOutputCallback(callable $callback)Parameters
- 
                callable$callback
Throws
PHPUnit_Framework_ExceptionsetPreserveGlobalState() ¶ public
setPreserveGlobalState(bool $preserveGlobalState)Parameters
- 
                bool$preserveGlobalState
Throws
PHPUnit_Framework_ExceptionsetRegisterMockObjectsFromTestArgumentsRecursively() ¶ public
setRegisterMockObjectsFromTestArgumentsRecursively(bool $flag)Parameters
- 
                bool$flag
setRunTestInSeparateProcess() ¶ public
setRunTestInSeparateProcess(bool $runTestInSeparateProcess)Parameters
- 
                bool$runTestInSeparateProcess
Throws
PHPUnit_Framework_ExceptionsetTestResultObject() ¶ public
setTestResultObject(PHPUnit_Framework_TestResult $result)Parameters
- 
                PHPUnit_Framework_TestResult$result
setUp() ¶ public
setUp(): voidAuto-detect if the HTTP middleware stack should be used.
Returns
voidsetUpBeforeClass() ¶ public static
setUpBeforeClass()This method is called before the first test of this test class is run.
setUseErrorHandler() ¶ public
setUseErrorHandler(bool $useErrorHandler)Parameters
- 
                bool$useErrorHandler
skipIf() ¶ public
skipIf(bool $shouldSkip, string $message = ''): boolOverrides SimpleTestCase::skipIf to provide a boolean return value
Parameters
- 
                bool$shouldSkip
- Whether or not the test should be skipped. 
- 
                string$message optional
- The message to display. 
Returns
boolskipUnless() ¶ protected
skipUnless(bool $condition, string $message = ''): boolCompatibility function for skipping.
Parameters
- 
                bool$condition
- Condition to trigger skipping 
- 
                string$message optional
- Message for skip 
Returns
boolstringContains() ¶ public static
stringContains(string $string, bool $case = true): PHPUnit_Framework_Constraint_StringContainsReturns a PHPUnit_Framework_Constraint_StringContains matcher object.
Parameters
- 
                string$string
- 
                bool$case optional
Returns
PHPUnit_Framework_Constraint_StringContainsstringEndsWith() ¶ public static
stringEndsWith(mixed $suffix): PHPUnit_Framework_Constraint_StringEndsWithReturns a PHPUnit_Framework_Constraint_StringEndsWith matcher object.
Parameters
- 
                mixed$suffix
Returns
PHPUnit_Framework_Constraint_StringEndsWithstringStartsWith() ¶ public static
stringStartsWith(mixed $prefix): PHPUnit_Framework_Constraint_StringStartsWithReturns a PHPUnit_Framework_Constraint_StringStartsWith matcher object.
Parameters
- 
                mixed$prefix
Returns
PHPUnit_Framework_Constraint_StringStartsWithtearDownAfterClass() ¶ public static
tearDownAfterClass()This method is called after the last test of this test class is run.
throwException() ¶ public static
throwException(Throwable|Exception $exception): PHPUnit_Framework_MockObject_Stub_ExceptionParameters
- 
                Throwable|Exception$exception
Returns
PHPUnit_Framework_MockObject_Stub_ExceptiontoString() ¶ public
toString(): stringReturns a string representation of the test case.
Returns
stringuseHttpServer() ¶ public
useHttpServer(bool $enable): voidToggle whether or not you want to use the HTTP Server stack.
Parameters
- 
                bool$enable
- Enable/disable the usage of the HTTP Stack. 
Returns
voidviewVariable() ¶ public
viewVariable(string $name): mixedFetches a view variable by name.
If the view variable does not exist, null will be returned.
Parameters
- 
                string$name
- The view variable to get. 
Returns
mixedThe view variable if set.
Property Detail
$_csrfToken ¶ protected
Boolean flag for whether or not the request should have a CSRF token added.
Type
bool$_securityToken ¶ protected
Boolean flag for whether or not the request should have a SecurityComponent token added.
Type
bool$_useHttpServer ¶ protected
Track whether or not tests are run against the PSR7 HTTP stack.
Type
bool$autoFixtures ¶ public
By default, all fixtures attached to this class will be truncated and reloaded after each test. Set this to false to handle manually
Type
bool$backupGlobals ¶ protected
Enable or disable the backup and restoration of the $GLOBALS array. Overwrite this attribute in a child class of TestCase. Setting this attribute in setUp() has no effect!
Type
bool$backupStaticAttributes ¶ protected
Enable or disable the backup and restoration of static attributes. Overwrite this attribute in a child class of TestCase. Setting this attribute in setUp() has no effect!
Type
bool$dropTables ¶ public
Control table create/drops on each test method.
If true, tables will still be dropped at the end of each test runner execution.
Type
bool$fixtureManager ¶ public
The class responsible for managing the creation, loading and removing of fixtures
Type
Cake\TestSuite\Fixture\FixtureManager$preserveGlobalState ¶ protected
Whether or not this test should preserve the global state when running in a separate PHP process.
Type
bool$runTestInSeparateProcess ¶ protected
Whether or not this test is to be run in a separate PHP process.
Type
bool