SuiteCRM-Core/tests/api/V8/GetModulesMetaCest.php
Dillon-Brown 8e4cc94994 Squashed 'public/legacy/' content from commit 817a12dc0
git-subtree-dir: public/legacy
git-subtree-split: 817a12dc0c30c189f56d5cb1f7dc37a9631bdbe3
2021-03-31 15:37:32 +01:00

64 lines
1.4 KiB
PHP

<?php
namespace Test\Api\V8;
use ApiTester;
use ArrayIterator;
use Codeception\Example;
use Codeception\Exception\ModuleException;
use Exception;
class GetModulesMetaCest
{
/**
* @param ApiTester $I
*
* @throws ModuleException
*/
public function _before(ApiTester $I)
{
$I->login();
}
/**
* @param ApiTester $I
* @param Example $example
*
* @dataProvider shouldWorkDataProvider
* @throws Exception
*/
public function shouldWork(ApiTester $I, Example $example)
{
/** @var ArrayIterator $iterator */
$iterator = $example->getIterator();
$I->sendGET($I->getInstanceURL() . $iterator->offsetGet('endPoint'));
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(['type' => 'modules']);
$I->seeResponseContainsJson(
[
'data' =>
[
'Accounts' => [
'label' => 'Accounts',
'access' => ['access']
],
],
]
);
}
/**
* @return array
*/
protected function shouldWorkDataProvider()
{
return [
[
'shouldWork01' => 'returnsModules',
'endPoint' => '/Api/V8/meta/modules',
],
];
}
}