OXDEV-3559 Add codeception tests
This commit is contained in:
bovenliggende
cfb85dacad
commit
8c4b19b495
38
tests/Codeception/Acceptance/CategoryQueryCest.php
Normal file
38
tests/Codeception/Acceptance/CategoryQueryCest.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright © OXID eSales AG. All rights reserved.
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace __Vendor__\GraphQL\__Package__\Tests\Codeception\Acceptance;
|
||||
|
||||
use __Vendor__\GraphQL\__Package__\Tests\Codeception\AcceptanceTester;
|
||||
|
||||
class CategoryQueryCest
|
||||
{
|
||||
public function testFetchSingleCategoryById(AcceptanceTester $I): void
|
||||
{
|
||||
$I->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'
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
2
tests/Codeception/_output/.gitignore
vendored
Normal file
2
tests/Codeception/_output/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
35
tests/Codeception/_support/AcceptanceTester.php
Normal file
35
tests/Codeception/_support/AcceptanceTester.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright © OXID eSales AG. All rights reserved.
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace __Vendor__\GraphQL\__Package__\Tests\Codeception;
|
||||
|
||||
/**
|
||||
* 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 \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
|
||||
*
|
||||
* @SuppressWarnings(PHPMD)
|
||||
*/
|
||||
class AcceptanceTester extends \Codeception\Actor
|
||||
{
|
||||
use _generated\AcceptanceTesterActions;
|
||||
|
||||
/*
|
||||
* Define custom actions here
|
||||
*/
|
||||
}
|
23
tests/Codeception/_support/Helper/Acceptance.php
Normal file
23
tests/Codeception/_support/Helper/Acceptance.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright © OXID eSales AG. All rights reserved.
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace __Vendor__\GraphQL\__Package__\Tests\Codeception\Helper;
|
||||
|
||||
use OxidEsales\Facts\Facts;
|
||||
|
||||
// here you can define custom actions
|
||||
// all public methods declared in helper class will be available in $I
|
||||
|
||||
class Acceptance extends \Codeception\Module
|
||||
{
|
||||
public function _beforeSuite($settings = []) {
|
||||
exec((new Facts())->getShopRootPath() . '/bin/oe-console oe:module:activate oe/graphql-base');
|
||||
exec((new Facts())->getShopRootPath() . '/bin/oe-console oe:module:activate __PackageFull__');
|
||||
}
|
||||
}
|
2
tests/Codeception/_support/_generated/.gitignore
vendored
Normal file
2
tests/Codeception/_support/_generated/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
10
tests/Codeception/acceptance.suite.yml
Normal file
10
tests/Codeception/acceptance.suite.yml
Normal file
@ -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
|
10
tests/Codeception/codeception.yml
Normal file
10
tests/Codeception/codeception.yml
Normal file
@ -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
|
16
tests/Codeception/params.php
Normal file
16
tests/Codeception/params.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright © OXID eSales AG. All rights reserved.
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use OxidEsales\Facts\Facts;
|
||||
|
||||
$facts = new Facts();
|
||||
|
||||
return [
|
||||
'SHOP_URL' => $facts->getShopUrl(),
|
||||
];
|
21
tests/codeception.yml
Normal file
21
tests/codeception.yml
Normal file
@ -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
|
Laden…
Verwijs in nieuw issue
Block a user