Первая фиксация
This commit is contained in:
7
Mirzaev/Feip/Tests/Bar.suite.yml
Normal file
7
Mirzaev/Feip/Tests/Bar.suite.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
actor: BarTester
|
||||
modules:
|
||||
enabled:
|
||||
- \Helper\Foo
|
||||
- REST:
|
||||
url: http://feip.loc/api/bar
|
||||
depends: PhpBrowser
|
107
Mirzaev/Feip/Tests/Bar/BarCest.php
Normal file
107
Mirzaev/Feip/Tests/Bar/BarCest.php
Normal 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"}]}');
|
||||
}
|
||||
}
|
7
Mirzaev/Feip/Tests/Foo.suite.yml
Normal file
7
Mirzaev/Feip/Tests/Foo.suite.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
actor: FooTester
|
||||
modules:
|
||||
enabled:
|
||||
- \Helper\Foo
|
||||
- REST:
|
||||
url: http://feip.loc/api/foo
|
||||
depends: PhpBrowser
|
191
Mirzaev/Feip/Tests/Foo/FooCest.php
Normal file
191
Mirzaev/Feip/Tests/Foo/FooCest.php
Normal 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"}]}');
|
||||
}
|
||||
}
|
0
Mirzaev/Feip/Tests/_data/.gitkeep
Normal file
0
Mirzaev/Feip/Tests/_data/.gitkeep
Normal file
1
Mirzaev/Feip/Tests/_output/.gitignore
vendored
Normal file
1
Mirzaev/Feip/Tests/_output/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
./*
|
0
Mirzaev/Feip/Tests/_output/.gitkeep
Normal file
0
Mirzaev/Feip/Tests/_output/.gitkeep
Normal file
26
Mirzaev/Feip/Tests/_support/BarTester.php
Normal file
26
Mirzaev/Feip/Tests/_support/BarTester.php
Normal 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
|
||||
*/
|
||||
}
|
26
Mirzaev/Feip/Tests/_support/FooTester.php
Normal file
26
Mirzaev/Feip/Tests/_support/FooTester.php
Normal 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
|
||||
*/
|
||||
}
|
10
Mirzaev/Feip/Tests/_support/Helper/Bar.php
Normal file
10
Mirzaev/Feip/Tests/_support/Helper/Bar.php
Normal 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
|
||||
{
|
||||
|
||||
}
|
10
Mirzaev/Feip/Tests/_support/Helper/Foo.php
Normal file
10
Mirzaev/Feip/Tests/_support/Helper/Foo.php
Normal 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
|
||||
{
|
||||
|
||||
}
|
1982
Mirzaev/Feip/Tests/_support/_generated/BarTesterActions.php
Normal file
1982
Mirzaev/Feip/Tests/_support/_generated/BarTesterActions.php
Normal file
File diff suppressed because it is too large
Load Diff
1982
Mirzaev/Feip/Tests/_support/_generated/FooTesterActions.php
Normal file
1982
Mirzaev/Feip/Tests/_support/_generated/FooTesterActions.php
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user