mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-08-29 01:10:42 +08:00
Fix Codeception Tests
- Remove old functional tests - Fix aspect mock conf at the run all level - Fix view definition handler unit test
This commit is contained in:
parent
9ad9e189bc
commit
7df391c37c
7 changed files with 30 additions and 38 deletions
|
@ -20,3 +20,4 @@ extensions:
|
|||
- Codeception\Extension\RunFailed
|
||||
params:
|
||||
- .env
|
||||
bootstrap: bootstrap.php
|
||||
|
|
|
@ -69,7 +69,7 @@ class LineActionDefinitionProvider implements LineActionDefinitionProviderInterf
|
|||
$this->appListStrings = $appListStringsObject->getItems();
|
||||
}
|
||||
|
||||
$defaults = $this->listViewLineActions['default'];
|
||||
$defaults = $this->listViewLineActions['default'] ?? [];
|
||||
$defaultActions = $defaults['actions'] ?? [];
|
||||
|
||||
$createActions = $defaultActions['create'] ?? [];
|
||||
|
|
28
tests/bootstrap.php
Normal file
28
tests/bootstrap.php
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
include __DIR__.'/../vendor/autoload.php'; // composer autoload
|
||||
|
||||
use AspectMock\Kernel;
|
||||
|
||||
$kernel = Kernel::getInstance();
|
||||
$kernel->init([
|
||||
'debug' => true,
|
||||
'appDir' => __DIR__ . '/..',
|
||||
'cacheDir' => __DIR__ . '/../cache/test/aop',
|
||||
'includePaths' => [
|
||||
__DIR__ . '/../core/src',
|
||||
__DIR__ . '/../core/legacy',
|
||||
__DIR__ . '/../vendor/api-platform',
|
||||
],
|
||||
'excludePaths' => [
|
||||
__DIR__,
|
||||
'/../vendor/codeception', '/../vendor/phpunit'
|
||||
],
|
||||
]);
|
||||
|
||||
$kernel->loadFile(__DIR__ . '/../core/legacy/AclHandler.php');
|
||||
$kernel->loadFile(__DIR__ . '/../core/legacy/Authentication.php');
|
||||
$kernel->loadFile(__DIR__ . '/../vendor/api-platform/core/src/Metadata/Resource/ResourceMetadata.php');
|
||||
$kernel->loadFile(__DIR__ . '/../vendor/api-platform/core/src/Util/RequestAttributesExtractor.php');
|
||||
$kernel->loadFile(__DIR__ . '/../vendor/api-platform/core/src/Metadata/Resource/Factory/AnnotationResourceFilterMetadataFactory.php');
|
||||
$kernel->loadFile(__DIR__ . '/../vendor/api-platform/core/src/Security/EventListener/DenyAccessListener.php');
|
0
tests/functional/.gitkeep
Normal file
0
tests/functional/.gitkeep
Normal file
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
namespace App\Tests;
|
||||
|
||||
use App\Repository\UserRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
class DefaultControllerCest extends WebTestCase
|
||||
{
|
||||
public function testVisitingWhileLoggedIn(): void
|
||||
{
|
||||
$client = static::createClient();
|
||||
$userRepository = static::$container->get(UserRepository::class);
|
||||
|
||||
$testUser = $userRepository->findOneBy('admin');
|
||||
$client->loginUser($testUser);
|
||||
|
||||
$client->request('GET', '/#/Home');
|
||||
$this->assertResponseIsSuccessful();
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Tests;
|
||||
|
||||
use App\Tests\FunctionalTester;
|
||||
|
||||
class LoginCest
|
||||
{
|
||||
public function tryBypassCSRF(FunctionalTester $I): void
|
||||
{
|
||||
$I->amOnPage('login');
|
||||
$I->seeResponseCodeIs(403);
|
||||
}
|
||||
}
|
||||
|
|
@ -183,8 +183,6 @@ final class ViewDefinitionsHandlerTest extends Unit
|
|||
static::assertArrayHasKey('label', $firstColumn);
|
||||
static::assertArrayHasKey('link', $firstColumn);
|
||||
static::assertIsBool($firstColumn['link']);
|
||||
static::assertArrayHasKey('default', $firstColumn);
|
||||
static::assertIsBool($firstColumn['default']);
|
||||
static::assertArrayHasKey('sortable', $firstColumn);
|
||||
static::assertIsBool($firstColumn['sortable']);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue