expectException(MyException::class, function() { * $this->doSomethingBad(); * }); * * $I->expectException(new MyException(), function() { * $this->doSomethingBad(); * }); * ``` * If you want to check message or exception code, you can pass them with exception instance: * ```php * expectException(new MyException("Don't do bad things"), function() { * $this->doSomethingBad(); * }); * ``` * * @param $exception string or \Exception * @param $callback * @deprecated Use expectThrowable() instead * @see \Codeception\Module\Asserts::expectException() */ public function expectException($exception, $callback) { return $this->getScenario()->runStep(new Action('expectException', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Handles and checks throwables (Exceptions/Errors) called inside the callback function. * Either throwable class name or throwable instance should be provided. * * ```php * expectThrowable(MyThrowable::class, function() { * $this->doSomethingBad(); * }); * * $I->expectThrowable(new MyException(), function() { * $this->doSomethingBad(); * }); * ``` * If you want to check message or throwable code, you can pass them with throwable instance: * ```php * expectThrowable(new MyError("Don't do bad things"), function() { * $this->doSomethingBad(); * }); * ``` * * @param $throwable string or \Throwable * @param $callback * @see \Codeception\Module\Asserts::expectThrowable() */ public function expectThrowable($throwable, $callback) { return $this->getScenario()->runStep(new Action('expectThrowable', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that two variables are equal. * * @param $expected * @param $actual * @param string $message * @param float $delta * @see \Codeception\Module\Asserts::assertEquals() */ public function assertEquals($expected, $actual, $message = null, $delta = null) { return $this->getScenario()->runStep(new Action('assertEquals', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that two variables are not equal * * @param $expected * @param $actual * @param string $message * @param float $delta * @see \Codeception\Module\Asserts::assertNotEquals() */ public function assertNotEquals($expected, $actual, $message = null, $delta = null) { return $this->getScenario()->runStep(new Action('assertNotEquals', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that two variables are same * * @param $expected * @param $actual * @param string $message * @see \Codeception\Module\Asserts::assertSame() */ public function assertSame($expected, $actual, $message = null) { return $this->getScenario()->runStep(new Action('assertSame', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that two variables are not same * * @param $expected * @param $actual * @param string $message * @see \Codeception\Module\Asserts::assertNotSame() */ public function assertNotSame($expected, $actual, $message = null) { return $this->getScenario()->runStep(new Action('assertNotSame', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that actual is greater than expected * * @param $expected * @param $actual * @param string $message * @see \Codeception\Module\Asserts::assertGreaterThan() */ public function assertGreaterThan($expected, $actual, $message = null) { return $this->getScenario()->runStep(new Action('assertGreaterThan', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that actual is greater or equal than expected * * @param $expected * @param $actual * @param string $message * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() */ public function assertGreaterThanOrEqual($expected, $actual, $message = null) { return $this->getScenario()->runStep(new Action('assertGreaterThanOrEqual', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that actual is less than expected * * @param $expected * @param $actual * @param string $message * @see \Codeception\Module\Asserts::assertLessThan() */ public function assertLessThan($expected, $actual, $message = null) { return $this->getScenario()->runStep(new Action('assertLessThan', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that actual is less or equal than expected * * @param $expected * @param $actual * @param string $message * @see \Codeception\Module\Asserts::assertLessThanOrEqual() */ public function assertLessThanOrEqual($expected, $actual, $message = null) { return $this->getScenario()->runStep(new Action('assertLessThanOrEqual', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that haystack contains needle * * @param $needle * @param $haystack * @param string $message * @see \Codeception\Module\Asserts::assertContains() */ public function assertContains($needle, $haystack, $message = null) { return $this->getScenario()->runStep(new Action('assertContains', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that haystack doesn't contain needle. * * @param $needle * @param $haystack * @param string $message * @see \Codeception\Module\Asserts::assertNotContains() */ public function assertNotContains($needle, $haystack, $message = null) { return $this->getScenario()->runStep(new Action('assertNotContains', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that string match with pattern * * @param string $pattern * @param string $string * @param string $message * @see \Codeception\Module\Asserts::assertRegExp() */ public function assertRegExp($pattern, $string, $message = null) { return $this->getScenario()->runStep(new Action('assertRegExp', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that string match with pattern * * Alias of assertRegExp * @param string $pattern * @param string $string * @param string $message * @see \Codeception\Module\Asserts::assertMatchesRegularExpression() */ public function assertMatchesRegularExpression($pattern, $string, $message = null) { return $this->getScenario()->runStep(new Action('assertMatchesRegularExpression', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that string not match with pattern * * @param string $pattern * @param string $string * @param string $message * @see \Codeception\Module\Asserts::assertNotRegExp() */ public function assertNotRegExp($pattern, $string, $message = null) { return $this->getScenario()->runStep(new Action('assertNotRegExp', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that string not match with pattern * * Alias of assertNotRegExp * @param string $pattern * @param string $string * @param string $message * @see \Codeception\Module\Asserts::assertDoesNotMatchRegularExpression() */ public function assertDoesNotMatchRegularExpression($pattern, $string, $message = null) { return $this->getScenario()->runStep(new Action('assertDoesNotMatchRegularExpression', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that a string starts with the given prefix. * * @param string $prefix * @param string $string * @param string $message * @see \Codeception\Module\Asserts::assertStringStartsWith() */ public function assertStringStartsWith($prefix, $string, $message = null) { return $this->getScenario()->runStep(new Action('assertStringStartsWith', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that a string doesn't start with the given prefix. * * @param string $prefix * @param string $string * @param string $message * @see \Codeception\Module\Asserts::assertStringStartsNotWith() */ public function assertStringStartsNotWith($prefix, $string, $message = null) { return $this->getScenario()->runStep(new Action('assertStringStartsNotWith', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that variable is empty. * * @param $actual * @param string $message * @see \Codeception\Module\Asserts::assertEmpty() */ public function assertEmpty($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertEmpty', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that variable is not empty. * * @param $actual * @param string $message * @see \Codeception\Module\Asserts::assertNotEmpty() */ public function assertNotEmpty($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertNotEmpty', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that variable is NULL * * @param $actual * @param string $message * @see \Codeception\Module\Asserts::assertNull() */ public function assertNull($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertNull', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that variable is not NULL * * @param $actual * @param string $message * @see \Codeception\Module\Asserts::assertNotNull() */ public function assertNotNull($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertNotNull', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that condition is positive. * * @param $condition * @param string $message * @see \Codeception\Module\Asserts::assertTrue() */ public function assertTrue($condition, $message = null) { return $this->getScenario()->runStep(new Action('assertTrue', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that the condition is NOT true (everything but true) * * @param $condition * @param string $message * @see \Codeception\Module\Asserts::assertNotTrue() */ public function assertNotTrue($condition, $message = null) { return $this->getScenario()->runStep(new Action('assertNotTrue', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that condition is negative. * * @param $condition * @param string $message * @see \Codeception\Module\Asserts::assertFalse() */ public function assertFalse($condition, $message = null) { return $this->getScenario()->runStep(new Action('assertFalse', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks that the condition is NOT false (everything but false) * * @param $condition * @param string $message * @see \Codeception\Module\Asserts::assertNotFalse() */ public function assertNotFalse($condition, $message = null) { return $this->getScenario()->runStep(new Action('assertNotFalse', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks if file exists * * @param string $filename * @param string $message * @see \Codeception\Module\Asserts::assertFileExists() */ public function assertFileExists($filename, $message = null) { return $this->getScenario()->runStep(new Action('assertFileExists', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks if file doesn't exist * * @param string $filename * @param string $message * @see \Codeception\Module\Asserts::assertFileNotExists() */ public function assertFileNotExists($filename, $message = null) { return $this->getScenario()->runStep(new Action('assertFileNotExists', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Checks if file doesn't exist * * Alias of assertFileNotExists * @param string $filename * @param string $message * @see \Codeception\Module\Asserts::assertFileDoesNotExist() */ public function assertFileDoesNotExist($filename, $message = null) { return $this->getScenario()->runStep(new Action('assertFileDoesNotExist', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * @param $expected * @param $actual * @param $description * @see \Codeception\Module\Asserts::assertGreaterOrEquals() */ public function assertGreaterOrEquals($expected, $actual, $description = null) { return $this->getScenario()->runStep(new Action('assertGreaterOrEquals', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * @param $expected * @param $actual * @param $description * @see \Codeception\Module\Asserts::assertLessOrEquals() */ public function assertLessOrEquals($expected, $actual, $description = null) { return $this->getScenario()->runStep(new Action('assertLessOrEquals', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * @param $actual * @param $description * @see \Codeception\Module\Asserts::assertIsEmpty() */ public function assertIsEmpty($actual, $description = null) { return $this->getScenario()->runStep(new Action('assertIsEmpty', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * @param $key * @param $actual * @param $description * @see \Codeception\Module\Asserts::assertArrayHasKey() */ public function assertArrayHasKey($key, $actual, $description = null) { return $this->getScenario()->runStep(new Action('assertArrayHasKey', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * @param $key * @param $actual * @param $description * @see \Codeception\Module\Asserts::assertArrayNotHasKey() */ public function assertArrayNotHasKey($key, $actual, $description = null) { return $this->getScenario()->runStep(new Action('assertArrayNotHasKey', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * @param $expectedCount * @param $actual * @param $description * @see \Codeception\Module\Asserts::assertCount() */ public function assertCount($expectedCount, $actual, $description = null) { return $this->getScenario()->runStep(new Action('assertCount', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * @param string $expected * @param mixed $actual * @param string $message * @see \Helper\ExtraAsserts::assertInstanceOf() */ public function assertInstanceOf($expected, $actual, $message = null) { return $this->getScenario()->runStep(new Action('assertInstanceOf', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * @param $class * @param $actual * @param $description * @see \Codeception\Module\Asserts::assertNotInstanceOf() */ public function assertNotInstanceOf($class, $actual, $description = null) { return $this->getScenario()->runStep(new Action('assertNotInstanceOf', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * @param $type * @param $actual * @param $description * @see \Codeception\Module\Asserts::assertInternalType() */ public function assertInternalType($type, $actual, $description = null) { return $this->getScenario()->runStep(new Action('assertInternalType', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * Fails the test with message. * * @param $message * @see \Codeception\Module\Asserts::fail() */ public function fail($message) { return $this->getScenario()->runStep(new Action('fail', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertStringContainsString() */ public function assertStringContainsString($needle, $haystack, $message = null) { return $this->getScenario()->runStep(new Action('assertStringContainsString', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertStringNotContainsString() */ public function assertStringNotContainsString($needle, $haystack, $message = null) { return $this->getScenario()->runStep(new Action('assertStringNotContainsString', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertStringContainsStringIgnoringCase() */ public function assertStringContainsStringIgnoringCase($needle, $haystack, $message = null) { return $this->getScenario()->runStep(new Action('assertStringContainsStringIgnoringCase', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertStringNotContainsStringIgnoringCase() */ public function assertStringNotContainsStringIgnoringCase($needle, $haystack, $message = null) { return $this->getScenario()->runStep(new Action('assertStringNotContainsStringIgnoringCase', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * @since 1.1.0 of module-asserts * @see \Codeception\Module\Asserts::assertStringEndsWith() */ public function assertStringEndsWith($suffix, $string, $message = null) { return $this->getScenario()->runStep(new Action('assertStringEndsWith', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * @since 1.1.0 of module-asserts * @see \Codeception\Module\Asserts::assertStringEndsNotWith() */ public function assertStringEndsNotWith($suffix, $string, $message = null) { return $this->getScenario()->runStep(new Action('assertStringEndsNotWith', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertIsArray() */ public function assertIsArray($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertIsArray', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertIsBool() */ public function assertIsBool($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertIsBool', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertIsFloat() */ public function assertIsFloat($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertIsFloat', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertIsInt() */ public function assertIsInt($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertIsInt', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertIsNumeric() */ public function assertIsNumeric($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertIsNumeric', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertIsObject() */ public function assertIsObject($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertIsObject', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertIsResource() */ public function assertIsResource($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertIsResource', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertIsString() */ public function assertIsString($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertIsString', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertIsScalar() */ public function assertIsScalar($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertIsScalar', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertIsCallable() */ public function assertIsCallable($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertIsCallable', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertIsNotArray() */ public function assertIsNotArray($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertIsNotArray', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertIsNotBool() */ public function assertIsNotBool($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertIsNotBool', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertIsNotFloat() */ public function assertIsNotFloat($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertIsNotFloat', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertIsNotInt() */ public function assertIsNotInt($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertIsNotInt', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertIsNotNumeric() */ public function assertIsNotNumeric($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertIsNotNumeric', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertIsNotObject() */ public function assertIsNotObject($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertIsNotObject', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertIsNotResource() */ public function assertIsNotResource($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertIsNotResource', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertIsNotString() */ public function assertIsNotString($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertIsNotString', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertIsNotScalar() */ public function assertIsNotScalar($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertIsNotScalar', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertIsNotCallable() */ public function assertIsNotCallable($actual, $message = null) { return $this->getScenario()->runStep(new Action('assertIsNotCallable', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertEqualsCanonicalizing() */ public function assertEqualsCanonicalizing($expected, $actual, $message = null) { return $this->getScenario()->runStep(new Action('assertEqualsCanonicalizing', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertNotEqualsCanonicalizing() */ public function assertNotEqualsCanonicalizing($expected, $actual, $message = null) { return $this->getScenario()->runStep(new Action('assertNotEqualsCanonicalizing', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertEqualsIgnoringCase() */ public function assertEqualsIgnoringCase($expected, $actual, $message = null) { return $this->getScenario()->runStep(new Action('assertEqualsIgnoringCase', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertNotEqualsIgnoringCase() */ public function assertNotEqualsIgnoringCase($expected, $actual, $message = null) { return $this->getScenario()->runStep(new Action('assertNotEqualsIgnoringCase', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertEqualsWithDelta() */ public function assertEqualsWithDelta($expected, $actual, $delta, $message = null) { return $this->getScenario()->runStep(new Action('assertEqualsWithDelta', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Codeception\Module\Asserts::assertNotEqualsWithDelta() */ public function assertNotEqualsWithDelta($expected, $actual, $delta, $message = null) { return $this->getScenario()->runStep(new Action('assertNotEqualsWithDelta', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Helper\ExtraAsserts::assertCanSave() */ public function assertCanSave($model) { return $this->getScenario()->runStep(new Action('assertCanSave', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Helper\ExtraAsserts::assertCanNotSave() */ public function assertCanNotSave($model, $message = null) { return $this->getScenario()->runStep(new Action('assertCanNotSave', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * * @see \Helper\ExtraAsserts::haveNotFinishedTest() */ public function haveNotFinishedTest() { return $this->getScenario()->runStep(new Action('haveNotFinishedTest', func_get_args())); } }