N°6097 - Tests: Optimize performances by creating custom env. only once and re-using it across test classes

This commit is contained in:
Molkobain
2023-07-20 19:47:25 +02:00
parent 1ad28312ec
commit ed6df77cbb
9 changed files with 155 additions and 135 deletions

View File

@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.7">
<classes>
<class id="Person">
<fields>
<field id="tested_attribute2" xsi:type="AttributeString" _delta="define">
<sql>tested_attribute2</sql>
<default_value/>
<is_null_allowed>true</is_null_allowed>
</field>
</fields>
</class>
</classes>
</itop_design>

View File

@@ -1,34 +0,0 @@
<?php
/*
* @copyright Copyright (C) 2010-2023 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Test\UnitTest\Core;
use Combodo\iTop\Test\UnitTest\ItopCustomDatamodelTestCase;
use DBObjectSet;
use DBSearch;
use MetaModel;
/**
* @runTestsInSeparateProcesseszzz
* @preserveGlobalState disabled
* @backupGlobals disabled
*/
class TestGLA2Test extends ItopCustomDatamodelTestCase
{
/**
* @inheritDoc
*/
public function GetDatamodelDeltaAbsPath(): string
{
return APPROOT.'tests/php-unit-tests/unitary-tests/core/TestGLA/TestGLA2Test.delta.xml';
}
public function testFoo()
{
static::assertFalse(MetaModel::IsValidAttCode('Person', 'non_existing_attribute2'));
static::assertTrue(MetaModel::IsValidAttCode('Person', 'tested_attribute2'));
}
}

View File

@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.7">
<classes>
<class id="Person">
<fields>
<field id="tested_attribute" xsi:type="AttributeString" _delta="define">
<sql>tested_attribute</sql>
<default_value/>
<is_null_allowed>true</is_null_allowed>
</field>
</fields>
</class>
</classes>
</itop_design>

View File

@@ -1,34 +0,0 @@
<?php
/*
* @copyright Copyright (C) 2010-2023 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Test\UnitTest\Core;
use Combodo\iTop\Test\UnitTest\ItopCustomDatamodelTestCase;
use DBObjectSet;
use DBSearch;
use MetaModel;
/**
* @runTestsInSeparateProcesseszzz
* @preserveGlobalState disabled
* @backupGlobals disabled
*/
class TestGLATest extends ItopCustomDatamodelTestCase
{
/**
* @inheritDoc
*/
public function GetDatamodelDeltaAbsPath(): string
{
return APPROOT.'tests/php-unit-tests/unitary-tests/core/TestGLA/TestGLATest.delta.xml';
}
public function testFoo()
{
static::assertFalse(MetaModel::IsValidAttCode('Person', 'non_existing_attribute'));
static::assertTrue(MetaModel::IsValidAttCode('Person', 'tested_attribute'));
}
}