diff --git a/tests/Codeception/Acceptance/CategoryQueryCest.php b/tests/Codeception/Acceptance/CategoryQueryCest.php new file mode 100644 index 0000000..5e56ed3 --- /dev/null +++ b/tests/Codeception/Acceptance/CategoryQueryCest.php @@ -0,0 +1,38 @@ +haveHTTPHeader('Content-Type', 'application/json'); + $I->sendPOST('/widget.php?cl=graphql', [ + 'query' => 'query { + category (id: "943a9ba3050e78b443c16e043ae60ef3") { + id + title + } + }' + ]); + $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); + $I->seeResponseIsJson(); + $I->seeResponseContainsJson([ + 'data' => [ + 'category' => [ + 'id' => '943a9ba3050e78b443c16e043ae60ef3', + 'title' => 'Kiteboarding' + ] + ] + ]); + } +} diff --git a/tests/Codeception/_output/.gitignore b/tests/Codeception/_output/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/tests/Codeception/_output/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/tests/Codeception/_support/AcceptanceTester.php b/tests/Codeception/_support/AcceptanceTester.php new file mode 100644 index 0000000..45bfa95 --- /dev/null +++ b/tests/Codeception/_support/AcceptanceTester.php @@ -0,0 +1,35 @@ +getShopRootPath() . '/bin/oe-console oe:module:activate oe/graphql-base'); + exec((new Facts())->getShopRootPath() . '/bin/oe-console oe:module:activate __PackageFull__'); + } +} diff --git a/tests/Codeception/_support/_generated/.gitignore b/tests/Codeception/_support/_generated/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/tests/Codeception/_support/_generated/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/tests/Codeception/acceptance.suite.yml b/tests/Codeception/acceptance.suite.yml new file mode 100644 index 0000000..70603ba --- /dev/null +++ b/tests/Codeception/acceptance.suite.yml @@ -0,0 +1,10 @@ +# suite config +actor: AcceptanceTester +path: Acceptance +modules: + enabled: + - \__Vendor__\GraphQL\__Package__\Tests\Codeception\Helper\Acceptance + - REST: + url: '%SHOP_URL%' + depends: PhpBrowser + part: Json diff --git a/tests/Codeception/codeception.yml b/tests/Codeception/codeception.yml new file mode 100644 index 0000000..f0446cc --- /dev/null +++ b/tests/Codeception/codeception.yml @@ -0,0 +1,10 @@ +paths: + tests: tests + output: tests/_output + data: tests/_data + support: tests/_support + envs: tests/_envs +actor_suffix: Tester +extensions: + enabled: + - Codeception\Extension\RunFailed diff --git a/tests/Codeception/params.php b/tests/Codeception/params.php new file mode 100644 index 0000000..42f1ec2 --- /dev/null +++ b/tests/Codeception/params.php @@ -0,0 +1,16 @@ + $facts->getShopUrl(), +]; diff --git a/tests/codeception.yml b/tests/codeception.yml new file mode 100644 index 0000000..32f7b6c --- /dev/null +++ b/tests/codeception.yml @@ -0,0 +1,21 @@ +namespace: __Vendor__\GraphQL\__Package__\Tests\Codeception + +params: + - Codeception/params.php + +paths: + tests: Codeception + output: Codeception/_output + data: Codeception/_data + support: Codeception/_support + envs: Codeception/_envs + actor_suffix: Tester + +settings: + colors: true + log: true + shuffle: true + +extensions: + enabled: + - Codeception\Extension\RunFailed