2251 lines
75 KiB
PHP
2251 lines
75 KiB
PHP
<?php //[STAMP] d0668a78e08efaa6754b7410cfc57129
|
|
namespace _generated;
|
|
|
|
// This class was automatically generated by build task
|
|
// You should not change it manually as it will be overwritten on next build
|
|
// @codingStandardsIgnoreFile
|
|
|
|
use Codeception\Module\Asserts;
|
|
use Helper\Api;
|
|
use Helper\DataSetup;
|
|
use Codeception\Module\REST;
|
|
|
|
trait ApiTesterActions
|
|
{
|
|
/**
|
|
* @return \Codeception\Scenario
|
|
*/
|
|
abstract protected function getScenario();
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that two variables are equal.
|
|
*
|
|
* @param $expected
|
|
* @param $actual
|
|
* @param string $message
|
|
* @see \Codeception\Module\Asserts::assertEquals()
|
|
*/
|
|
public function assertEquals($expected, $actual, $message = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\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
|
|
* @see \Codeception\Module\Asserts::assertNotEquals()
|
|
*/
|
|
public function assertNotEquals($expected, $actual, $message = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\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
|
|
* @return mixed|void
|
|
* @see \Codeception\Module\Asserts::assertSame()
|
|
*/
|
|
public function assertSame($expected, $actual, $message = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\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 \Codeception\Step\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 \Codeception\Step\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 \Codeception\Step\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 \Codeception\Step\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 \Codeception\Step\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 \Codeception\Step\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 \Codeception\Step\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 \Codeception\Step\Action('assertRegExp', 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 \Codeception\Step\Action('assertNotRegExp', 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 \Codeception\Step\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 \Codeception\Step\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 \Codeception\Step\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 \Codeception\Step\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 \Codeception\Step\Action('assertTrue', 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 \Codeception\Step\Action('assertFalse', 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 \Codeception\Step\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 \Codeception\Step\Action('assertFileNotExists', 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 \Codeception\Step\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 \Codeception\Step\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 \Codeception\Step\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 \Codeception\Step\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 \Codeception\Step\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 \Codeception\Step\Action('assertCount', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* @param $class
|
|
* @param $actual
|
|
* @param $description
|
|
* @see \Codeception\Module\Asserts::assertInstanceOf()
|
|
*/
|
|
public function assertInstanceOf($class, $actual, $description = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\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 \Codeception\Step\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 \Codeception\Step\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 \Codeception\Step\Action('fail', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Handles and checks exception called inside callback function.
|
|
* Either exception class name or exception instance should be provided.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->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
|
|
* <?php
|
|
* // will check that exception MyException is thrown with "Don't do bad things" message
|
|
* $I->expectException(new MyException("Don't do bad things"), function() {
|
|
* $this->doSomethingBad();
|
|
* });
|
|
* ```
|
|
*
|
|
* @param $exception string or \Exception
|
|
* @param $callback
|
|
* @see \Codeception\Module\Asserts::expectException()
|
|
*/
|
|
public function expectException($exception, $callback) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Retrieves the user's credentials from the test data
|
|
*
|
|
* @return mixed
|
|
* @throws \Codeception\Exception\ModuleException
|
|
* @see \Helper\Api::getUserCredentials()
|
|
*/
|
|
public function getUserCredentials() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('getUserCredentials', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* @return mixed
|
|
* @throws \Codeception\Exception\ModuleException
|
|
* @see \Helper\Api::getMediaTypes()
|
|
*/
|
|
public function getMediaTypes() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('getMediaTypes', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Returns a list of ids available in the given folder
|
|
*
|
|
* @param string $folderPath
|
|
*
|
|
* @return array<string,int|string>
|
|
* @see \Helper\DataSetup::getFilesDataForFolder()
|
|
*/
|
|
public function getFilesDataForFolder($folderPath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('getFilesDataForFolder', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* @return mixed
|
|
* @throws \Codeception\Exception\ModuleException
|
|
* @see \Helper\Api::getSharedFile()
|
|
*/
|
|
public function getSharedFile() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('getSharedFile', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* @return mixed
|
|
* @throws \Codeception\Exception\ModuleException
|
|
* @see \Helper\Api::getPrivateFile()
|
|
*/
|
|
public function getPrivateFile() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('getPrivateFile', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* @return mixed
|
|
* @throws \Codeception\Exception\ModuleException
|
|
* @see \Helper\Api::getSharedFolder()
|
|
*/
|
|
public function getSharedFolder() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('getSharedFolder', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
*
|
|
* @see \Helper\DataSetup::createBrokenConfig()
|
|
*/
|
|
public function createBrokenConfig() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('createBrokenConfig', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
*
|
|
* @see \Helper\DataSetup::createConfigWithBom()
|
|
*/
|
|
public function createConfigWithBom() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('createConfigWithBom', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
*
|
|
* @see \Helper\DataSetup::emptyConfig()
|
|
*/
|
|
public function emptyConfig() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('emptyConfig', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
*
|
|
* @see \Helper\DataSetup::restoreValidConfig()
|
|
*/
|
|
public function restoreValidConfig() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('restoreValidConfig', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sets HTTP header valid for all next requests. Use `deleteHeader` to unset it
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->haveHttpHeader('Content-Type', 'application/json');
|
|
* // all next requests will contain this header
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $name
|
|
* @param $value
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::haveHttpHeader()
|
|
*/
|
|
public function haveHttpHeader($name, $value) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('haveHttpHeader', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Deletes the header with the passed name. Subsequent requests
|
|
* will not have the deleted header in its request.
|
|
*
|
|
* Example:
|
|
* ```php
|
|
* <?php
|
|
* $I->haveHttpHeader('X-Requested-With', 'Codeception');
|
|
* $I->sendGET('test-headers.php');
|
|
* // ...
|
|
* $I->deleteHeader('X-Requested-With');
|
|
* $I->sendPOST('some-other-page.php');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $name the name of the header to delete.
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::deleteHeader()
|
|
*/
|
|
public function deleteHeader($name) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('deleteHeader', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks over the given HTTP header and (optionally)
|
|
* its value, asserting that are there
|
|
*
|
|
* @param $name
|
|
* @param $value
|
|
* @part json
|
|
* @part xml
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeHttpHeader()
|
|
*/
|
|
public function canSeeHttpHeader($name, $value = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeHttpHeader', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks over the given HTTP header and (optionally)
|
|
* its value, asserting that are there
|
|
*
|
|
* @param $name
|
|
* @param $value
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeHttpHeader()
|
|
*/
|
|
public function seeHttpHeader($name, $value = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeHttpHeader', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks over the given HTTP header and (optionally)
|
|
* its value, asserting that are not there
|
|
*
|
|
* @param $name
|
|
* @param $value
|
|
* @part json
|
|
* @part xml
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::dontSeeHttpHeader()
|
|
*/
|
|
public function cantSeeHttpHeader($name, $value = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeHttpHeader', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks over the given HTTP header and (optionally)
|
|
* its value, asserting that are not there
|
|
*
|
|
* @param $name
|
|
* @param $value
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::dontSeeHttpHeader()
|
|
*/
|
|
public function dontSeeHttpHeader($name, $value = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeHttpHeader', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that http response header is received only once.
|
|
* HTTP RFC2616 allows multiple response headers with the same name.
|
|
* You can check that you didn't accidentally sent the same header twice.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeHttpHeaderOnce('Cache-Control');
|
|
* ?>>
|
|
* ```
|
|
*
|
|
* @param $name
|
|
* @part json
|
|
* @part xml
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeHttpHeaderOnce()
|
|
*/
|
|
public function canSeeHttpHeaderOnce($name) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeHttpHeaderOnce', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that http response header is received only once.
|
|
* HTTP RFC2616 allows multiple response headers with the same name.
|
|
* You can check that you didn't accidentally sent the same header twice.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeHttpHeaderOnce('Cache-Control');
|
|
* ?>>
|
|
* ```
|
|
*
|
|
* @param $name
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeHttpHeaderOnce()
|
|
*/
|
|
public function seeHttpHeaderOnce($name) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeHttpHeaderOnce', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Returns the value of the specified header name
|
|
*
|
|
* @param $name
|
|
* @param Boolean $first Whether to return the first value or all header values
|
|
*
|
|
* @return string|array The first header value if $first is true, an array of values otherwise
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::grabHttpHeader()
|
|
*/
|
|
public function grabHttpHeader($name, $first = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabHttpHeader', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Adds HTTP authentication via username/password.
|
|
*
|
|
* @param $username
|
|
* @param $password
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::amHttpAuthenticated()
|
|
*/
|
|
public function amHttpAuthenticated($username, $password) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Condition('amHttpAuthenticated', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Adds Digest authentication via username/password.
|
|
*
|
|
* @param $username
|
|
* @param $password
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::amDigestAuthenticated()
|
|
*/
|
|
public function amDigestAuthenticated($username, $password) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Condition('amDigestAuthenticated', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Adds Bearer authentication via access token.
|
|
*
|
|
* @param $accessToken
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::amBearerAuthenticated()
|
|
*/
|
|
public function amBearerAuthenticated($accessToken) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Condition('amBearerAuthenticated', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends a POST request to given uri.
|
|
*
|
|
* Parameters and files (as array of filenames) can be provided.
|
|
*
|
|
* @param $url
|
|
* @param array|\JsonSerializable $params
|
|
* @param array $files
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::sendPOST()
|
|
*/
|
|
public function sendPOST($url, $params = null, $files = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('sendPOST', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends a HEAD request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $params
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::sendHEAD()
|
|
*/
|
|
public function sendHEAD($url, $params = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('sendHEAD', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends an OPTIONS request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $params
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::sendOPTIONS()
|
|
*/
|
|
public function sendOPTIONS($url, $params = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('sendOPTIONS', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends a GET request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $params
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::sendGET()
|
|
*/
|
|
public function sendGET($url, $params = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('sendGET', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends PUT request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $params
|
|
* @param array $files
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::sendPUT()
|
|
*/
|
|
public function sendPUT($url, $params = null, $files = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('sendPUT', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends PATCH request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $params
|
|
* @param array $files
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::sendPATCH()
|
|
*/
|
|
public function sendPATCH($url, $params = null, $files = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('sendPATCH', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends DELETE request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $params
|
|
* @param array $files
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::sendDELETE()
|
|
*/
|
|
public function sendDELETE($url, $params = null, $files = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('sendDELETE', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends LINK request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $linkEntries (entry is array with keys "uri" and "link-param")
|
|
*
|
|
* @link http://tools.ietf.org/html/rfc2068#section-19.6.2.4
|
|
*
|
|
* @author samva.ua@gmail.com
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::sendLINK()
|
|
*/
|
|
public function sendLINK($url, $linkEntries) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('sendLINK', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends UNLINK request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $linkEntries (entry is array with keys "uri" and "link-param")
|
|
* @link http://tools.ietf.org/html/rfc2068#section-19.6.2.4
|
|
* @author samva.ua@gmail.com
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::sendUNLINK()
|
|
*/
|
|
public function sendUNLINK($url, $linkEntries) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('sendUNLINK', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether last response was valid JSON.
|
|
* This is done with json_last_error function.
|
|
*
|
|
* @part json
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeResponseIsJson()
|
|
*/
|
|
public function canSeeResponseIsJson() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseIsJson', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether last response was valid JSON.
|
|
* This is done with json_last_error function.
|
|
*
|
|
* @part json
|
|
* @see \Codeception\Module\REST::seeResponseIsJson()
|
|
*/
|
|
public function seeResponseIsJson() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseIsJson', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether the last response contains text.
|
|
*
|
|
* @param $text
|
|
* @part json
|
|
* @part xml
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeResponseContains()
|
|
*/
|
|
public function canSeeResponseContains($text) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseContains', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether the last response contains text.
|
|
*
|
|
* @param $text
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeResponseContains()
|
|
*/
|
|
public function seeResponseContains($text) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseContains', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether last response do not contain text.
|
|
*
|
|
* @param $text
|
|
* @part json
|
|
* @part xml
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::dontSeeResponseContains()
|
|
*/
|
|
public function cantSeeResponseContains($text) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseContains', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether last response do not contain text.
|
|
*
|
|
* @param $text
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::dontSeeResponseContains()
|
|
*/
|
|
public function dontSeeResponseContains($text) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeResponseContains', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether the last JSON response contains provided array.
|
|
* The response is converted to array with json_decode($response, true)
|
|
* Thus, JSON is represented by associative array.
|
|
* This method matches that response array contains provided array.
|
|
*
|
|
* Examples:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // response: {name: john, email: john@gmail.com}
|
|
* $I->seeResponseContainsJson(array('name' => 'john'));
|
|
*
|
|
* // response {user: john, profile: { email: john@gmail.com }}
|
|
* $I->seeResponseContainsJson(array('email' => 'john@gmail.com'));
|
|
*
|
|
* ?>
|
|
* ```
|
|
*
|
|
* This method recursively checks if one array can be found inside of another.
|
|
*
|
|
* @param array $json
|
|
* @part json
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeResponseContainsJson()
|
|
*/
|
|
public function canSeeResponseContainsJson($json = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseContainsJson', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether the last JSON response contains provided array.
|
|
* The response is converted to array with json_decode($response, true)
|
|
* Thus, JSON is represented by associative array.
|
|
* This method matches that response array contains provided array.
|
|
*
|
|
* Examples:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // response: {name: john, email: john@gmail.com}
|
|
* $I->seeResponseContainsJson(array('name' => 'john'));
|
|
*
|
|
* // response {user: john, profile: { email: john@gmail.com }}
|
|
* $I->seeResponseContainsJson(array('email' => 'john@gmail.com'));
|
|
*
|
|
* ?>
|
|
* ```
|
|
*
|
|
* This method recursively checks if one array can be found inside of another.
|
|
*
|
|
* @param array $json
|
|
* @part json
|
|
* @see \Codeception\Module\REST::seeResponseContainsJson()
|
|
*/
|
|
public function seeResponseContainsJson($json = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseContainsJson', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Returns current response so that it can be used in next scenario steps.
|
|
*
|
|
* Example:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $user_id = $I->grabResponse();
|
|
* $I->sendPUT('/user', array('id' => $user_id, 'name' => 'davert'));
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @version 1.1
|
|
* @return string
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::grabResponse()
|
|
*/
|
|
public function grabResponse() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabResponse', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Returns data from the current JSON response using [JSONPath](http://goessner.net/articles/JsonPath/) as selector.
|
|
* JsonPath is XPath equivalent for querying Json structures.
|
|
* Try your JsonPath expressions [online](http://jsonpath.curiousconcept.com/).
|
|
* Even for a single value an array is returned.
|
|
*
|
|
* This method **require [`flow/jsonpath` > 0.2](https://github.com/FlowCommunications/JSONPath/) library to be installed**.
|
|
*
|
|
* Example:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // match the first `user.id` in json
|
|
* $firstUserId = $I->grabDataFromResponseByJsonPath('$..users[0].id');
|
|
* $I->sendPUT('/user', array('id' => $firstUserId[0], 'name' => 'davert'));
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $jsonPath
|
|
* @return array Array of matching items
|
|
* @version 2.0.9
|
|
* @throws \Exception
|
|
* @part json
|
|
* @see \Codeception\Module\REST::grabDataFromResponseByJsonPath()
|
|
*/
|
|
public function grabDataFromResponseByJsonPath($jsonPath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabDataFromResponseByJsonPath', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if json structure in response matches the xpath provided.
|
|
* JSON is not supposed to be checked against XPath, yet it can be converted to xml and used with XPath.
|
|
* This assertion allows you to check the structure of response json.
|
|
* *
|
|
* ```json
|
|
* { "store": {
|
|
* "book": [
|
|
* { "category": "reference",
|
|
* "author": "Nigel Rees",
|
|
* "title": "Sayings of the Century",
|
|
* "price": 8.95
|
|
* },
|
|
* { "category": "fiction",
|
|
* "author": "Evelyn Waugh",
|
|
* "title": "Sword of Honour",
|
|
* "price": 12.99
|
|
* }
|
|
* ],
|
|
* "bicycle": {
|
|
* "color": "red",
|
|
* "price": 19.95
|
|
* }
|
|
* }
|
|
* }
|
|
* ```
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // at least one book in store has author
|
|
* $I->seeResponseJsonMatchesXpath('//store/book/author');
|
|
* // first book in store has author
|
|
* $I->seeResponseJsonMatchesXpath('//store/book[1]/author');
|
|
* // at least one item in store has price
|
|
* $I->seeResponseJsonMatchesXpath('/store//price');
|
|
* ?>
|
|
* ```
|
|
* @param string $xpath
|
|
* @part json
|
|
* @version 2.0.9
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeResponseJsonMatchesXpath()
|
|
*/
|
|
public function canSeeResponseJsonMatchesXpath($xpath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseJsonMatchesXpath', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if json structure in response matches the xpath provided.
|
|
* JSON is not supposed to be checked against XPath, yet it can be converted to xml and used with XPath.
|
|
* This assertion allows you to check the structure of response json.
|
|
* *
|
|
* ```json
|
|
* { "store": {
|
|
* "book": [
|
|
* { "category": "reference",
|
|
* "author": "Nigel Rees",
|
|
* "title": "Sayings of the Century",
|
|
* "price": 8.95
|
|
* },
|
|
* { "category": "fiction",
|
|
* "author": "Evelyn Waugh",
|
|
* "title": "Sword of Honour",
|
|
* "price": 12.99
|
|
* }
|
|
* ],
|
|
* "bicycle": {
|
|
* "color": "red",
|
|
* "price": 19.95
|
|
* }
|
|
* }
|
|
* }
|
|
* ```
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // at least one book in store has author
|
|
* $I->seeResponseJsonMatchesXpath('//store/book/author');
|
|
* // first book in store has author
|
|
* $I->seeResponseJsonMatchesXpath('//store/book[1]/author');
|
|
* // at least one item in store has price
|
|
* $I->seeResponseJsonMatchesXpath('/store//price');
|
|
* ?>
|
|
* ```
|
|
* @param string $xpath
|
|
* @part json
|
|
* @version 2.0.9
|
|
* @see \Codeception\Module\REST::seeResponseJsonMatchesXpath()
|
|
*/
|
|
public function seeResponseJsonMatchesXpath($xpath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseJsonMatchesXpath', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Opposite to seeResponseJsonMatchesXpath
|
|
*
|
|
* @param string $xpath
|
|
* @part json
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::dontSeeResponseJsonMatchesXpath()
|
|
*/
|
|
public function cantSeeResponseJsonMatchesXpath($xpath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseJsonMatchesXpath', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Opposite to seeResponseJsonMatchesXpath
|
|
*
|
|
* @param string $xpath
|
|
* @part json
|
|
* @see \Codeception\Module\REST::dontSeeResponseJsonMatchesXpath()
|
|
*/
|
|
public function dontSeeResponseJsonMatchesXpath($xpath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeResponseJsonMatchesXpath', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if json structure in response matches [JsonPath](http://goessner.net/articles/JsonPath/).
|
|
* JsonPath is XPath equivalent for querying Json structures.
|
|
* Try your JsonPath expressions [online](http://jsonpath.curiousconcept.com/).
|
|
* This assertion allows you to check the structure of response json.
|
|
*
|
|
* This method **require [`flow/jsonpath` > 0.2](https://github.com/FlowCommunications/JSONPath/) library to be installed**.
|
|
*
|
|
* ```json
|
|
* { "store": {
|
|
* "book": [
|
|
* { "category": "reference",
|
|
* "author": "Nigel Rees",
|
|
* "title": "Sayings of the Century",
|
|
* "price": 8.95
|
|
* },
|
|
* { "category": "fiction",
|
|
* "author": "Evelyn Waugh",
|
|
* "title": "Sword of Honour",
|
|
* "price": 12.99
|
|
* }
|
|
* ],
|
|
* "bicycle": {
|
|
* "color": "red",
|
|
* "price": 19.95
|
|
* }
|
|
* }
|
|
* }
|
|
* ```
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // at least one book in store has author
|
|
* $I->seeResponseJsonMatchesJsonPath('$.store.book[*].author');
|
|
* // first book in store has author
|
|
* $I->seeResponseJsonMatchesJsonPath('$.store.book[0].author');
|
|
* // at least one item in store has price
|
|
* $I->seeResponseJsonMatchesJsonPath('$.store..price');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $jsonPath
|
|
* @part json
|
|
* @version 2.0.9
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeResponseJsonMatchesJsonPath()
|
|
*/
|
|
public function canSeeResponseJsonMatchesJsonPath($jsonPath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseJsonMatchesJsonPath', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if json structure in response matches [JsonPath](http://goessner.net/articles/JsonPath/).
|
|
* JsonPath is XPath equivalent for querying Json structures.
|
|
* Try your JsonPath expressions [online](http://jsonpath.curiousconcept.com/).
|
|
* This assertion allows you to check the structure of response json.
|
|
*
|
|
* This method **require [`flow/jsonpath` > 0.2](https://github.com/FlowCommunications/JSONPath/) library to be installed**.
|
|
*
|
|
* ```json
|
|
* { "store": {
|
|
* "book": [
|
|
* { "category": "reference",
|
|
* "author": "Nigel Rees",
|
|
* "title": "Sayings of the Century",
|
|
* "price": 8.95
|
|
* },
|
|
* { "category": "fiction",
|
|
* "author": "Evelyn Waugh",
|
|
* "title": "Sword of Honour",
|
|
* "price": 12.99
|
|
* }
|
|
* ],
|
|
* "bicycle": {
|
|
* "color": "red",
|
|
* "price": 19.95
|
|
* }
|
|
* }
|
|
* }
|
|
* ```
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // at least one book in store has author
|
|
* $I->seeResponseJsonMatchesJsonPath('$.store.book[*].author');
|
|
* // first book in store has author
|
|
* $I->seeResponseJsonMatchesJsonPath('$.store.book[0].author');
|
|
* // at least one item in store has price
|
|
* $I->seeResponseJsonMatchesJsonPath('$.store..price');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $jsonPath
|
|
* @part json
|
|
* @version 2.0.9
|
|
* @see \Codeception\Module\REST::seeResponseJsonMatchesJsonPath()
|
|
*/
|
|
public function seeResponseJsonMatchesJsonPath($jsonPath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseJsonMatchesJsonPath', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Opposite to seeResponseJsonMatchesJsonPath
|
|
*
|
|
* @param string $jsonPath
|
|
* @part json
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::dontSeeResponseJsonMatchesJsonPath()
|
|
*/
|
|
public function cantSeeResponseJsonMatchesJsonPath($jsonPath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseJsonMatchesJsonPath', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Opposite to seeResponseJsonMatchesJsonPath
|
|
*
|
|
* @param string $jsonPath
|
|
* @part json
|
|
* @see \Codeception\Module\REST::dontSeeResponseJsonMatchesJsonPath()
|
|
*/
|
|
public function dontSeeResponseJsonMatchesJsonPath($jsonPath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeResponseJsonMatchesJsonPath', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Opposite to seeResponseContainsJson
|
|
*
|
|
* @part json
|
|
* @param array $json
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::dontSeeResponseContainsJson()
|
|
*/
|
|
public function cantSeeResponseContainsJson($json = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseContainsJson', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Opposite to seeResponseContainsJson
|
|
*
|
|
* @part json
|
|
* @param array $json
|
|
* @see \Codeception\Module\REST::dontSeeResponseContainsJson()
|
|
*/
|
|
public function dontSeeResponseContainsJson($json = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeResponseContainsJson', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that Json matches provided types.
|
|
* In case you don't know the actual values of JSON data returned you can match them by type.
|
|
* Starts check with a root element. If JSON data is array it will check the first element of an array.
|
|
* You can specify the path in the json which should be checked with JsonPath
|
|
*
|
|
* Basic example:
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // {'user_id': 1, 'name': 'davert', 'is_active': false}
|
|
* $I->seeResponseMatchesJsonType([
|
|
* 'user_id' => 'integer',
|
|
* 'name' => 'string|null',
|
|
* 'is_active' => 'boolean'
|
|
* ]);
|
|
*
|
|
* // narrow down matching with JsonPath:
|
|
* // {"users": [{ "name": "davert"}, {"id": 1}]}
|
|
* $I->seeResponseMatchesJsonType(['name' => 'string'], '$.users[0]');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* In this case you can match that record contains fields with data types you expected.
|
|
* The list of possible data types:
|
|
*
|
|
* * string
|
|
* * integer
|
|
* * float
|
|
* * array (json object is array as well)
|
|
* * boolean
|
|
*
|
|
* You can also use nested data type structures:
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // {'user_id': 1, 'name': 'davert', 'company': {'name': 'Codegyre'}}
|
|
* $I->seeResponseMatchesJsonType([
|
|
* 'user_id' => 'integer|string', // multiple types
|
|
* 'company' => ['name' => 'string']
|
|
* ]);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* You can also apply filters to check values. Filter can be applied with `:` char after the type declatation.
|
|
*
|
|
* Here is the list of possible filters:
|
|
*
|
|
* * `integer:>{val}` - checks that integer is greater than {val} (works with float and string types too).
|
|
* * `integer:<{val}` - checks that integer is lower than {val} (works with float and string types too).
|
|
* * `string:url` - checks that value is valid url.
|
|
* * `string:date` - checks that value is date in JavaScript format: https://weblog.west-wind.com/posts/2014/Jan/06/JavaScript-JSON-Date-Parsing-and-real-Dates
|
|
* * `string:email` - checks that value is a valid email according to http://emailregex.com/
|
|
* * `string:regex({val})` - checks that string matches a regex provided with {val}
|
|
*
|
|
* This is how filters can be used:
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // {'user_id': 1, 'email' => 'davert@codeception.com'}
|
|
* $I->seeResponseMatchesJsonType([
|
|
* 'user_id' => 'string:>0:<1000', // multiple filters can be used
|
|
* 'email' => 'string:regex(~\@~)' // we just check that @ char is included
|
|
* ]);
|
|
*
|
|
* // {'user_id': '1'}
|
|
* $I->seeResponseMatchesJsonType([
|
|
* 'user_id' => 'string:>0', // works with strings as well
|
|
* }
|
|
* ?>
|
|
* ```
|
|
*
|
|
* You can also add custom filters y accessing `JsonType::addCustomFilter` method.
|
|
* See [JsonType reference](http://codeception.com/docs/reference/JsonType).
|
|
*
|
|
* @part json
|
|
* @version 2.1.3
|
|
* @param array $jsonType
|
|
* @param string $jsonPath
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeResponseMatchesJsonType()
|
|
*/
|
|
public function canSeeResponseMatchesJsonType($jsonType, $jsonPath = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseMatchesJsonType', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that Json matches provided types.
|
|
* In case you don't know the actual values of JSON data returned you can match them by type.
|
|
* Starts check with a root element. If JSON data is array it will check the first element of an array.
|
|
* You can specify the path in the json which should be checked with JsonPath
|
|
*
|
|
* Basic example:
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // {'user_id': 1, 'name': 'davert', 'is_active': false}
|
|
* $I->seeResponseMatchesJsonType([
|
|
* 'user_id' => 'integer',
|
|
* 'name' => 'string|null',
|
|
* 'is_active' => 'boolean'
|
|
* ]);
|
|
*
|
|
* // narrow down matching with JsonPath:
|
|
* // {"users": [{ "name": "davert"}, {"id": 1}]}
|
|
* $I->seeResponseMatchesJsonType(['name' => 'string'], '$.users[0]');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* In this case you can match that record contains fields with data types you expected.
|
|
* The list of possible data types:
|
|
*
|
|
* * string
|
|
* * integer
|
|
* * float
|
|
* * array (json object is array as well)
|
|
* * boolean
|
|
*
|
|
* You can also use nested data type structures:
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // {'user_id': 1, 'name': 'davert', 'company': {'name': 'Codegyre'}}
|
|
* $I->seeResponseMatchesJsonType([
|
|
* 'user_id' => 'integer|string', // multiple types
|
|
* 'company' => ['name' => 'string']
|
|
* ]);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* You can also apply filters to check values. Filter can be applied with `:` char after the type declatation.
|
|
*
|
|
* Here is the list of possible filters:
|
|
*
|
|
* * `integer:>{val}` - checks that integer is greater than {val} (works with float and string types too).
|
|
* * `integer:<{val}` - checks that integer is lower than {val} (works with float and string types too).
|
|
* * `string:url` - checks that value is valid url.
|
|
* * `string:date` - checks that value is date in JavaScript format: https://weblog.west-wind.com/posts/2014/Jan/06/JavaScript-JSON-Date-Parsing-and-real-Dates
|
|
* * `string:email` - checks that value is a valid email according to http://emailregex.com/
|
|
* * `string:regex({val})` - checks that string matches a regex provided with {val}
|
|
*
|
|
* This is how filters can be used:
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // {'user_id': 1, 'email' => 'davert@codeception.com'}
|
|
* $I->seeResponseMatchesJsonType([
|
|
* 'user_id' => 'string:>0:<1000', // multiple filters can be used
|
|
* 'email' => 'string:regex(~\@~)' // we just check that @ char is included
|
|
* ]);
|
|
*
|
|
* // {'user_id': '1'}
|
|
* $I->seeResponseMatchesJsonType([
|
|
* 'user_id' => 'string:>0', // works with strings as well
|
|
* }
|
|
* ?>
|
|
* ```
|
|
*
|
|
* You can also add custom filters y accessing `JsonType::addCustomFilter` method.
|
|
* See [JsonType reference](http://codeception.com/docs/reference/JsonType).
|
|
*
|
|
* @part json
|
|
* @version 2.1.3
|
|
* @param array $jsonType
|
|
* @param string $jsonPath
|
|
* @see \Codeception\Module\REST::seeResponseMatchesJsonType()
|
|
*/
|
|
public function seeResponseMatchesJsonType($jsonType, $jsonPath = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseMatchesJsonType', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Opposite to `seeResponseMatchesJsonType`.
|
|
*
|
|
* @part json
|
|
* @see seeResponseMatchesJsonType
|
|
* @param $jsonType jsonType structure
|
|
* @param null $jsonPath optionally set specific path to structure with JsonPath
|
|
* @version 2.1.3
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::dontSeeResponseMatchesJsonType()
|
|
*/
|
|
public function cantSeeResponseMatchesJsonType($jsonType, $jsonPath = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseMatchesJsonType', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Opposite to `seeResponseMatchesJsonType`.
|
|
*
|
|
* @part json
|
|
* @see seeResponseMatchesJsonType
|
|
* @param $jsonType jsonType structure
|
|
* @param null $jsonPath optionally set specific path to structure with JsonPath
|
|
* @version 2.1.3
|
|
* @see \Codeception\Module\REST::dontSeeResponseMatchesJsonType()
|
|
*/
|
|
public function dontSeeResponseMatchesJsonType($jsonType, $jsonPath = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeResponseMatchesJsonType', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if response is exactly the same as provided.
|
|
*
|
|
* @part json
|
|
* @part xml
|
|
* @param $response
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeResponseEquals()
|
|
*/
|
|
public function canSeeResponseEquals($expected) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseEquals', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if response is exactly the same as provided.
|
|
*
|
|
* @part json
|
|
* @part xml
|
|
* @param $response
|
|
* @see \Codeception\Module\REST::seeResponseEquals()
|
|
*/
|
|
public function seeResponseEquals($expected) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseEquals', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks response code equals to provided value.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->seeResponseCodeIs(200);
|
|
*
|
|
* // preferred to use \Codeception\Util\HttpCode
|
|
* $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
|
|
* ```
|
|
*
|
|
* @part json
|
|
* @part xml
|
|
* @param $code
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeResponseCodeIs()
|
|
*/
|
|
public function canSeeResponseCodeIs($code) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIs', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks response code equals to provided value.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->seeResponseCodeIs(200);
|
|
*
|
|
* // preferred to use \Codeception\Util\HttpCode
|
|
* $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
|
|
* ```
|
|
*
|
|
* @part json
|
|
* @part xml
|
|
* @param $code
|
|
* @see \Codeception\Module\REST::seeResponseCodeIs()
|
|
*/
|
|
public function seeResponseCodeIs($code) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIs', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that response code is not equal to provided value.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->dontSeeResponseCodeIs(200);
|
|
*
|
|
* // preferred to use \Codeception\Util\HttpCode
|
|
* $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK);
|
|
* ```
|
|
*
|
|
* @part json
|
|
* @part xml
|
|
* @param $code
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::dontSeeResponseCodeIs()
|
|
*/
|
|
public function cantSeeResponseCodeIs($code) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseCodeIs', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that response code is not equal to provided value.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->dontSeeResponseCodeIs(200);
|
|
*
|
|
* // preferred to use \Codeception\Util\HttpCode
|
|
* $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK);
|
|
* ```
|
|
*
|
|
* @part json
|
|
* @part xml
|
|
* @param $code
|
|
* @see \Codeception\Module\REST::dontSeeResponseCodeIs()
|
|
*/
|
|
public function dontSeeResponseCodeIs($code) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeResponseCodeIs', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether last response was valid XML.
|
|
* This is done with libxml_get_last_error function.
|
|
*
|
|
* @part xml
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeResponseIsXml()
|
|
*/
|
|
public function canSeeResponseIsXml() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseIsXml', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether last response was valid XML.
|
|
* This is done with libxml_get_last_error function.
|
|
*
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeResponseIsXml()
|
|
*/
|
|
public function seeResponseIsXml() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseIsXml', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks wheather XML response matches XPath
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->seeXmlResponseMatchesXpath('//root/user[@id=1]');
|
|
* ```
|
|
* @part xml
|
|
* @param $xpath
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeXmlResponseMatchesXpath()
|
|
*/
|
|
public function canSeeXmlResponseMatchesXpath($xpath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeXmlResponseMatchesXpath', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks wheather XML response matches XPath
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->seeXmlResponseMatchesXpath('//root/user[@id=1]');
|
|
* ```
|
|
* @part xml
|
|
* @param $xpath
|
|
* @see \Codeception\Module\REST::seeXmlResponseMatchesXpath()
|
|
*/
|
|
public function seeXmlResponseMatchesXpath($xpath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeXmlResponseMatchesXpath', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks wheather XML response does not match XPath
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->dontSeeXmlResponseMatchesXpath('//root/user[@id=1]');
|
|
* ```
|
|
* @part xml
|
|
* @param $xpath
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::dontSeeXmlResponseMatchesXpath()
|
|
*/
|
|
public function cantSeeXmlResponseMatchesXpath($xpath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeXmlResponseMatchesXpath', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks wheather XML response does not match XPath
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->dontSeeXmlResponseMatchesXpath('//root/user[@id=1]');
|
|
* ```
|
|
* @part xml
|
|
* @param $xpath
|
|
* @see \Codeception\Module\REST::dontSeeXmlResponseMatchesXpath()
|
|
*/
|
|
public function dontSeeXmlResponseMatchesXpath($xpath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeXmlResponseMatchesXpath', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Finds and returns text contents of element.
|
|
* Element is matched by either CSS or XPath
|
|
*
|
|
* @param $cssOrXPath
|
|
* @return string
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::grabTextContentFromXmlElement()
|
|
*/
|
|
public function grabTextContentFromXmlElement($cssOrXPath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabTextContentFromXmlElement', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Finds and returns attribute of element.
|
|
* Element is matched by either CSS or XPath
|
|
*
|
|
* @param $cssOrXPath
|
|
* @param $attribute
|
|
* @return string
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::grabAttributeFromXmlElement()
|
|
*/
|
|
public function grabAttributeFromXmlElement($cssOrXPath, $attribute) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabAttributeFromXmlElement', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks XML response equals provided XML.
|
|
* Comparison is done by canonicalizing both xml`s.
|
|
*
|
|
* Parameters can be passed either as DOMDocument, DOMNode, XML string, or array (if no attributes).
|
|
*
|
|
* @param $xml
|
|
* @part xml
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeXmlResponseEquals()
|
|
*/
|
|
public function canSeeXmlResponseEquals($xml) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeXmlResponseEquals', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks XML response equals provided XML.
|
|
* Comparison is done by canonicalizing both xml`s.
|
|
*
|
|
* Parameters can be passed either as DOMDocument, DOMNode, XML string, or array (if no attributes).
|
|
*
|
|
* @param $xml
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeXmlResponseEquals()
|
|
*/
|
|
public function seeXmlResponseEquals($xml) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeXmlResponseEquals', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks XML response does not equal to provided XML.
|
|
* Comparison is done by canonicalizing both xml`s.
|
|
*
|
|
* Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes).
|
|
*
|
|
* @param $xml
|
|
* @part xml
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::dontSeeXmlResponseEquals()
|
|
*/
|
|
public function cantSeeXmlResponseEquals($xml) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeXmlResponseEquals', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks XML response does not equal to provided XML.
|
|
* Comparison is done by canonicalizing both xml`s.
|
|
*
|
|
* Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes).
|
|
*
|
|
* @param $xml
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::dontSeeXmlResponseEquals()
|
|
*/
|
|
public function dontSeeXmlResponseEquals($xml) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeXmlResponseEquals', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks XML response includes provided XML.
|
|
* Comparison is done by canonicalizing both xml`s.
|
|
* Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes).
|
|
*
|
|
* Example:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeXmlResponseIncludes("<result>1</result>");
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $xml
|
|
* @part xml
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeXmlResponseIncludes()
|
|
*/
|
|
public function canSeeXmlResponseIncludes($xml) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeXmlResponseIncludes', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks XML response includes provided XML.
|
|
* Comparison is done by canonicalizing both xml`s.
|
|
* Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes).
|
|
*
|
|
* Example:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeXmlResponseIncludes("<result>1</result>");
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $xml
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeXmlResponseIncludes()
|
|
*/
|
|
public function seeXmlResponseIncludes($xml) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeXmlResponseIncludes', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks XML response does not include provided XML.
|
|
* Comparison is done by canonicalizing both xml`s.
|
|
* Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes).
|
|
*
|
|
* @param $xml
|
|
* @part xml
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::dontSeeXmlResponseIncludes()
|
|
*/
|
|
public function cantSeeXmlResponseIncludes($xml) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeXmlResponseIncludes', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks XML response does not include provided XML.
|
|
* Comparison is done by canonicalizing both xml`s.
|
|
* Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes).
|
|
*
|
|
* @param $xml
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::dontSeeXmlResponseIncludes()
|
|
*/
|
|
public function dontSeeXmlResponseIncludes($xml) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeXmlResponseIncludes', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if the hash of a binary response is exactly the same as provided.
|
|
* Parameter can be passed as any hash string supported by hash(), with an
|
|
* optional second parameter to specify the hash type, which defaults to md5.
|
|
*
|
|
* Example: Using md5 hash key
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->seeBinaryResponseEquals("8c90748342f19b195b9c6b4eff742ded");
|
|
* ?>
|
|
* ```
|
|
*
|
|
* Example: Using md5 for a file contents
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $fileData = file_get_contents("test_file.jpg");
|
|
* $I->seeBinaryResponseEquals(md5($fileData));
|
|
* ?>
|
|
* ```
|
|
* Example: Using sha256 hsah
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $fileData = '/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k='; // very small jpeg
|
|
* $I->seeBinaryResponseEquals(hash("sha256", base64_decode($fileData)), 'sha256');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $hash the hashed data response expected
|
|
* @param $algo the hash algorithm to use. Default md5.
|
|
* @part json
|
|
* @part xml
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeBinaryResponseEquals()
|
|
*/
|
|
public function canSeeBinaryResponseEquals($hash, $algo = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeBinaryResponseEquals', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if the hash of a binary response is exactly the same as provided.
|
|
* Parameter can be passed as any hash string supported by hash(), with an
|
|
* optional second parameter to specify the hash type, which defaults to md5.
|
|
*
|
|
* Example: Using md5 hash key
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->seeBinaryResponseEquals("8c90748342f19b195b9c6b4eff742ded");
|
|
* ?>
|
|
* ```
|
|
*
|
|
* Example: Using md5 for a file contents
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $fileData = file_get_contents("test_file.jpg");
|
|
* $I->seeBinaryResponseEquals(md5($fileData));
|
|
* ?>
|
|
* ```
|
|
* Example: Using sha256 hsah
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $fileData = '/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k='; // very small jpeg
|
|
* $I->seeBinaryResponseEquals(hash("sha256", base64_decode($fileData)), 'sha256');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $hash the hashed data response expected
|
|
* @param $algo the hash algorithm to use. Default md5.
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeBinaryResponseEquals()
|
|
*/
|
|
public function seeBinaryResponseEquals($hash, $algo = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeBinaryResponseEquals', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if the hash of a binary response is not the same as provided.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->dontSeeBinaryResponseEquals("8c90748342f19b195b9c6b4eff742ded");
|
|
* ?>
|
|
* ```
|
|
* Opposite to `seeBinaryResponseEquals`
|
|
*
|
|
* @param $hash the hashed data response expected
|
|
* @param $algo the hash algorithm to use. Default md5.
|
|
* @part json
|
|
* @part xml
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::dontSeeBinaryResponseEquals()
|
|
*/
|
|
public function cantSeeBinaryResponseEquals($hash, $algo = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeBinaryResponseEquals', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if the hash of a binary response is not the same as provided.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->dontSeeBinaryResponseEquals("8c90748342f19b195b9c6b4eff742ded");
|
|
* ?>
|
|
* ```
|
|
* Opposite to `seeBinaryResponseEquals`
|
|
*
|
|
* @param $hash the hashed data response expected
|
|
* @param $algo the hash algorithm to use. Default md5.
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::dontSeeBinaryResponseEquals()
|
|
*/
|
|
public function dontSeeBinaryResponseEquals($hash, $algo = null) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeBinaryResponseEquals', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Deprecated since 2.0.9 and removed since 2.1.0
|
|
*
|
|
* @param $path
|
|
* @throws ModuleException
|
|
* @deprecated
|
|
* @see \Codeception\Module\REST::grabDataFromJsonResponse()
|
|
*/
|
|
public function grabDataFromJsonResponse($path) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabDataFromJsonResponse', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Prevents automatic redirects to be followed by the client
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->stopFollowingRedirects();
|
|
* ```
|
|
*
|
|
* @part xml
|
|
* @part json
|
|
* @see \Codeception\Module\REST::stopFollowingRedirects()
|
|
*/
|
|
public function stopFollowingRedirects() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('stopFollowingRedirects', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Enables automatic redirects to be followed by the client
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->startFollowingRedirects();
|
|
* ```
|
|
*
|
|
* @part xml
|
|
* @part json
|
|
* @see \Codeception\Module\REST::startFollowingRedirects()
|
|
*/
|
|
public function startFollowingRedirects() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('startFollowingRedirects', func_get_args()));
|
|
}
|
|
}
|