Первая фиксация

This commit is contained in:
RedHood
2020-10-03 00:11:19 +10:00
commit 252b261720
30 changed files with 11119 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
actor: BarTester
modules:
enabled:
- \Helper\Foo
- REST:
url: http://feip.loc/api/bar
depends: PhpBrowser

View File

@@ -0,0 +1,107 @@
<?php
class BarCest
{
public function tryPostJsonToFilter(BarTester $I)
{
$I->haveHttpHeader('User-Agent', 'FEIP Tester');
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendPOST(
'/index.php',
[
'{
"bar": "asd",
"email": "test@mail.ru",
"users": [
{
"first_name": "Arsen",
"second_name": "Mirzaev",
"age": "19"
}
]
}'
]
);
$I->seeResponseContains('{"response":{"bar":"asd","email":"test@mail.ru","users":{"first_name":["Arsen"],"second_name":["Mirzaev"],"age":19}},"errors":[]}');
}
public function tryPostJsonToFilterButUsersHasSecond(BarTester $I)
{
$I->haveHttpHeader('User-Agent', 'FEIP Tester');
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendPOST(
'/index.php',
[
'{
"bar": "asd",
"email": "test@mail.ru",
"users": [
{
"first_name": "Arsen",
"second_name": "Mirzaev",
"age": "19"
},
{
"first_name": "Ivan",
"second_name": "Voronkov",
"age": "18"
}
]
}'
]
);
$I->seeResponseContains('{"response":{"bar":"asd","email":"test@mail.ru","users":[{"first_name":["Arsen"],"second_name":["Mirzaev"],"age":19},{"first_name":["Ivan"],"second_name":["Voronkov"],"age":18}]},"errors":[]}');
}
public function tryPostJsonToFilterButBarIsArray(BarTester $I)
{
$I->haveHttpHeader('User-Agent', 'FEIP Tester');
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendPOST(
'/index.php',
[
'{
"bar": [
{
"first_name": "Arsen",
"second_name": "Mirzaev",
"age": "19"
}
],
"email": "test@mail.ru",
"users": [
{
"first_name": "Arsen",
"second_name": "Mirzaev",
"age": "19"
}
]
}'
]
);
$I->seeResponseContains('{"response":{"bar":"","email":"test@mail.ru","users":{"first_name":["Arsen"],"second_name":["Mirzaev"],"age":19}},"errors":[{"type":200,"target":"bar","value":"\u041d\u0435\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430"}]}');
}
public function tryPostJsonToFilterButEmailHasWrongValue(BarTester $I)
{
$I->haveHttpHeader('User-Agent', 'FEIP Tester');
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendPOST(
'/index.php',
[
'{
"bar": "asd",
"email": "test@mail",
"users": [
{
"first_name": "Arsen",
"second_name": "Mirzaev",
"age": "19"
}
]
}'
]
);
$I->seeResponseContains('{"response":{"bar":"asd","email":"test@mail","users":{"first_name":["Arsen"],"second_name":["Mirzaev"],"age":19}},"errors":[{"type":200,"target":"email","value":"\u041d\u0435\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430"}]}');
}
}

View File

@@ -0,0 +1,7 @@
actor: FooTester
modules:
enabled:
- \Helper\Foo
- REST:
url: http://feip.loc/api/foo
depends: PhpBrowser

View File

@@ -0,0 +1,191 @@
<?php
class FooCest
{
public function tryPostJsonToFilter(FooTester $I)
{
$I->haveHttpHeader('User-Agent', 'FEIP Tester');
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendPOST(
'/index.php',
[
'{
"foo": "123",
"bar": "asd",
"baz": "79502885623"
}'
]
);
$I->seeResponseContains('{"response":{"foo":123,"bar":"asd","baz":"79502885623"},"errors":[]}');
}
public function tryPostJsonToFilterButFooIsEmpty(FooTester $I)
{
$I->haveHttpHeader('User-Agent', 'FEIP Tester');
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendPOST(
'/index.php',
[
'{
"foo": "",
"bar": "asd",
"baz": "79502885623"
}'
]
);
$I->seeResponseContains('{"response":{"foo":0,"bar":"asd","baz":"79502885623"},"errors":[{"type":100,"target":"foo","value":"\u041d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440"}]}');
}
public function tryPostJsonToFilterButFooHasWrongValue(FooTester $I)
{
$I->haveHttpHeader('User-Agent', 'FEIP Tester');
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendPOST(
'/index.php',
[
'{
"foo": "123абв",
"bar": "asd",
"baz": "79502885623"
}'
]
);
$I->seeResponseContains('{"response":{"foo":123,"bar":"asd","baz":"79502885623"},"errors":[{"type":200,"target":"foo","value":"\u041d\u0435\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430"}]}');
}
public function tryPostJsonToFilterButFooWithoutValue(FooTester $I)
{
$I->haveHttpHeader('User-Agent', 'FEIP Tester');
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendPOST(
'/index.php',
[
'{
"bar": "asd",
"baz": "79502885623"
}'
]
);
$I->seeResponseContains('{"response":{"foo":0,"bar":"asd","baz":"79502885623"},"errors":[{"type":100,"target":"foo","value":"\u041d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440"}]}');
}
public function tryPostJsonToFilterButBarIsEmpty(FooTester $I)
{
$I->haveHttpHeader('User-Agent', 'FEIP Tester');
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendPOST(
'/index.php',
[
'{
"foo": "123",
"bar": "",
"baz": "79502885623"
}'
]
);
$I->seeResponseContains('{"response":{"foo":123,"bar":"","baz":"79502885623"},"errors":[{"type":100,"target":"bar","value":"\u041d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440"}]}');
}
public function tryPostJsonToFilterButBarWithoutValue(FooTester $I)
{
$I->haveHttpHeader('User-Agent', 'FEIP Tester');
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendPOST(
'/index.php',
[
'{
"foo": "123",
"baz": "79502885623"
}'
]
);
$I->seeResponseContains('{"response":{"foo":123,"bar":"","baz":"79502885623"},"errors":[{"type":100,"target":"bar","value":"\u041d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440"}]}');
}
public function tryPostJsonToFilterButBazIsEmpty(FooTester $I)
{
$I->haveHttpHeader('User-Agent', 'FEIP Tester');
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendPOST(
'/index.php',
[
'{
"foo": "123",
"bar": "asd",
"baz": ""
}'
]
);
$I->seeResponseContains('{"response":{"foo":123,"bar":"asd","baz":""},"errors":[{"type":100,"target":"baz","value":"\u041d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440"}]}');
}
public function tryPostJsonToFilterButBazHasWrongValue(FooTester $I)
{
$I->haveHttpHeader('User-Agent', 'FEIP Tester');
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendPOST(
'/index.php',
[
'{
"foo": "123",
"bar": "asd",
"baz": "8 (950) 288-56-23"
}'
]
);
$I->seeResponseContains('{"response":{"foo":123,"bar":"asd","baz":"79502885623"},"errors":[{"type":200,"target":"baz","value":"\u041d\u0435\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430"}]}');
}
public function tryPostJsonToFilterButBazHasTooShortValue(FooTester $I)
{
$I->haveHttpHeader('User-Agent', 'FEIP Tester');
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendPOST(
'/index.php',
[
'{
"foo": "123",
"bar": "asd",
"baz": "260557"
}'
]
);
$I->seeResponseContains('{"response":{"foo":123,"bar":"asd","baz":"760557"},"errors":[{"type":200,"target":"baz","value":"\u041d\u0435\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430"}]}');
}
public function tryPostJsonToFilterButBazWithoutValue(FooTester $I)
{
$I->haveHttpHeader('User-Agent', 'FEIP Tester');
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendPOST(
'/index.php',
[
'{
"foo": "123",
"bar": "asd"
}'
]
);
$I->seeResponseContains('{"response":{"foo":123,"bar":"asd","baz":""},"errors":[{"type":100,"target":"baz","value":"\u041d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440"}]}');
}
public function tryPostJsonToFilterButBarIsArray(FooTester $I)
{
$I->haveHttpHeader('User-Agent', 'FEIP Tester');
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendPOST(
'/index.php',
[
'{
"foo": "123",
"bar": {
"bar_foo": "100",
"bar_bar": "sad"
},
"baz": "79502885623"
}'
]
);
$I->seeResponseContains('{"response":{"foo":123,"bar":"","baz":"79502885623"},"errors":[{"type":200,"target":"bar","value":"\u041d\u0435\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430"}]}');
}
}

View File

1
Mirzaev/Feip/Tests/_output/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
./*

View File

View File

@@ -0,0 +1,26 @@
<?php
/**
* Inherited Methods
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void comment($description)
* @method void pause()
*
* @SuppressWarnings(PHPMD)
*/
class BarTester extends \Codeception\Actor
{
use _generated\BarTesterActions;
/**
* Define custom actions here
*/
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* Inherited Methods
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void comment($description)
* @method void pause()
*
* @SuppressWarnings(PHPMD)
*/
class FooTester extends \Codeception\Actor
{
use _generated\FooTesterActions;
/**
* Define custom actions here
*/
}

View File

@@ -0,0 +1,10 @@
<?php
namespace Helper;
// here you can define custom actions
// all public methods declared in helper class will be available in $I
class Bar extends \Codeception\Module
{
}

View File

@@ -0,0 +1,10 @@
<?php
namespace Helper;
// here you can define custom actions
// all public methods declared in helper class will be available in $I
class Foo extends \Codeception\Module
{
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff