mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-22 18:18:46 +02:00
N°5857 Fix PHPUnitPrettyPrint with PHPUnit 9
This commit is contained in:
@@ -643,9 +643,9 @@ Mamy nadzieję, że spodoba ci się ta wersja tak samo, jak nam się podobało j
|
||||
'UI:UniversalSearch:LabelSelectTheClass' => 'Wybierz klasę do przeszukania: ',
|
||||
|
||||
'UI:CSVReport-Value-Modified' => 'Zmodyfikowano',
|
||||
'UI:CSVReport-Value-SetIssue' => 'Nie można było zmienić - powód: %1$s',
|
||||
'UI:CSVReport-Value-ChangeIssue' => 'Nie można zmienić na %1$s - powód: %2$s',
|
||||
'UI:CSVReport-Value-NoMatch' => 'Nie pasuje',
|
||||
'UI:CSVReport-Value-SetIssue' => 'Nie można było zmienić',
|
||||
'UI:CSVReport-Value-ChangeIssue' => 'Nie można zmienić na %1$s',
|
||||
'UI:CSVReport-Value-NoMatch' => 'Nie pasuje - powód: %1$s',
|
||||
'UI:CSVReport-Value-Missing' => 'Brak wymaganej wartości',
|
||||
'UI:CSVReport-Value-Ambiguous' => 'Uwaga: znaleziono %1$s obiektów',
|
||||
'UI:CSVReport-Row-Unchanged' => 'niezmieniony',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^8.5.23",
|
||||
"phpunit/phpunit" : "^9",
|
||||
"sempro/phpunit-pretty-print": "^1.4"
|
||||
}
|
||||
}
|
||||
|
||||
1208
test/composer.lock
generated
1208
test/composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -60,7 +60,7 @@ class ConfigTest extends ItopTestCase
|
||||
$this->assertFileExists($sTmpFile);
|
||||
$sFileContent = file_get_contents($sTmpFile);
|
||||
|
||||
$this->assertContains($sExpectedContains, $sFileContent, "File content doesn't contain : ".$sExpectedContains);
|
||||
$this->assertStringContainsString($sExpectedContains, $sFileContent, "File content doesn't contain : ".$sExpectedContains);
|
||||
}
|
||||
|
||||
public function ProviderPreserveVarOnWriteToFile()
|
||||
|
||||
@@ -564,7 +564,7 @@ class DBSearchTest extends ItopDataTestCase
|
||||
self::assertNull($oFirstResult, 'Null returned');
|
||||
break;
|
||||
case 'object':
|
||||
self::assertInternalType('object', $oFirstResult, 'Object returned');
|
||||
self::assertIsObject($oFirstResult, 'Object returned');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,7 +334,7 @@ class MetaModelTest extends ItopDataTestCase
|
||||
try {
|
||||
MetaModel::GetEnumStyle('Contact', 'name', '');
|
||||
} catch (CoreException $e) {
|
||||
self::assertContains('AttributeEnum', $e->getMessage());
|
||||
self::assertStringContainsString('AttributeEnum', $e->getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -147,15 +147,18 @@ class TagSetFieldDataTest extends ItopDataTestCase
|
||||
* Test invalid tag codes
|
||||
* @dataProvider InvalidTagCodeProvider
|
||||
*
|
||||
* @expectedException \CoreException
|
||||
*
|
||||
* @param string $sTagCode
|
||||
*
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function testInvalidTagCode($sTagCode)
|
||||
{
|
||||
$this->CreateTagData(TAG_CLASS, TAG_ATTCODE, $sTagCode, 'First');
|
||||
try {
|
||||
$this->CreateTagData(TAG_CLASS, TAG_ATTCODE, $sTagCode, 'First');
|
||||
}
|
||||
catch (CoreException $e) {
|
||||
static::assertTrue(true);
|
||||
return;
|
||||
}
|
||||
// Should not pass here
|
||||
static::assertFalse(true);
|
||||
}
|
||||
@@ -182,12 +185,16 @@ class TagSetFieldDataTest extends ItopDataTestCase
|
||||
|
||||
/**
|
||||
* Test invalid tag labels
|
||||
* @expectedException \CoreException
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function testInvalidTagLabel()
|
||||
{
|
||||
$this->CreateTagData(TAG_CLASS, TAG_ATTCODE, 'tag1', 'First|Second');
|
||||
try {
|
||||
$this->CreateTagData(TAG_CLASS, TAG_ATTCODE, 'tag1', 'First|Second');
|
||||
}
|
||||
catch (CoreException $e) {
|
||||
static::assertFalse(false);
|
||||
return;
|
||||
}
|
||||
// Should not pass here
|
||||
static::assertFalse(true);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class TriggerTest extends ItopDataTestCase
|
||||
$this->assertEquals('Unknown class \'Toto\' (<b title="Trigger">TriggerOnObjectCreate</b>::-1 ()<br/>)', $e1->getMessage());
|
||||
|
||||
$fullStackTraceAsString = $e1->getFullStackTraceAsString();
|
||||
$this->assertContains("MetaModel::NewObject", $fullStackTraceAsString,"new enriched exception should contain root cause method: " . $fullStackTraceAsString);
|
||||
$this->assertStringContainsString("MetaModel::NewObject", $fullStackTraceAsString,"new enriched exception should contain root cause method: " . $fullStackTraceAsString);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,8 +90,8 @@ PHP;
|
||||
public function testType()
|
||||
{
|
||||
$_SESSION['itop_env'] = 'production';
|
||||
$this->assertInternalType('string', Dict::S('Core:AttributeURL'));
|
||||
$this->assertInternalType('string', Dict::Format('Change:AttName_SetTo', '1', '2'));
|
||||
$this->assertIsString(Dict::S('Core:AttributeURL'));
|
||||
$this->assertIsString(Dict::Format('Change:AttName_SetTo', '1', '2'));
|
||||
}
|
||||
|
||||
public function testInitLangIfNeeded_NoApc()
|
||||
|
||||
@@ -97,9 +97,6 @@ class ormTagSetTest extends ItopDataTestCase
|
||||
|
||||
|
||||
/**
|
||||
* @expectedException \CoreException
|
||||
* @throws \CoreException
|
||||
* @throws \CoreUnexpectedValue
|
||||
*/
|
||||
public function testMaxTagLimit()
|
||||
{
|
||||
@@ -115,9 +112,10 @@ class ormTagSetTest extends ItopDataTestCase
|
||||
}
|
||||
catch (CoreException $e)
|
||||
{
|
||||
$this->debug('Awaited: '.$e->getMessage());
|
||||
throw $e;
|
||||
static::assertEquals('Maximum number of tags (3) reached for FAQ:domains', $e->getMessage());
|
||||
return;
|
||||
}
|
||||
static::assertFalse(true);
|
||||
}
|
||||
|
||||
public function testEquals()
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
namespace Combodo\iTop\Test\UnitTest\Integration;
|
||||
|
||||
use Combodo\iTop\Test\UnitTest\ItopTestCase;
|
||||
|
||||
use Dict;
|
||||
|
||||
class DictionariesConsistencyTest extends ItopTestCase
|
||||
@@ -151,7 +150,7 @@ class DictionariesConsistencyTest extends ItopTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider ImBulChanportCsvMessageStillOkProvider
|
||||
* @dataProvider ImportCsvMessageStillOkProvider
|
||||
* make sure N°5305 dictionary changes are still here and UI remains unbroken for any lang
|
||||
*/
|
||||
public function testImportCsvMessageStillOk($sLangCode, $sDictFile)
|
||||
@@ -173,11 +172,11 @@ class DictionariesConsistencyTest extends ItopTestCase
|
||||
foreach ($aLabelsToTest as $sLabelKey => $aLabelArgs){
|
||||
try{
|
||||
$sLabelValue = Dict::Format($sLabelKey, ...$aLabelArgs);
|
||||
var_dump($sLabelValue);
|
||||
} catch (\Exception $e){
|
||||
//$this->debug($sLabelValue);
|
||||
} catch (\ValueError $e){
|
||||
$aFailedLabels[] = $sLabelKey;
|
||||
|
||||
var_dump([
|
||||
$this->debug([
|
||||
'exception' => $e->getMessage(),
|
||||
'trace' => $e->getTraceAsString(),
|
||||
'label_name' => $sLabelKey,
|
||||
@@ -185,7 +184,7 @@ class DictionariesConsistencyTest extends ItopTestCase
|
||||
]);
|
||||
}
|
||||
}
|
||||
$this->assertEquals([], $aFailedLabels, "test fail for lang $sLangCode and labels (" . implode(",", $aFailedLabels) . ')');
|
||||
$this->assertEquals([], $aFailedLabels, "test fail for lang $sLangCode and labels (" . implode(", ", $aFailedLabels) . ')');
|
||||
}
|
||||
|
||||
public function ImportCsvMessageStillOkProvider(){
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
stopOnRisky="false"
|
||||
stopOnSkipped="false"
|
||||
verbose="true"
|
||||
printerClass="Sempro\PHPUnitPrettyPrinter\PrettyPrinter"
|
||||
printerClass="\Sempro\PHPUnitPrettyPrinter\PrettyPrinterForPhpUnit9"
|
||||
>
|
||||
|
||||
<php>
|
||||
@@ -69,7 +69,7 @@
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<!-- Code coverage white list -->
|
||||
<!-- Code coverage white list -->
|
||||
<filter>
|
||||
<whitelist>
|
||||
<file>../core/apc-emulation.php</file>
|
||||
|
||||
@@ -343,7 +343,7 @@ class DataSynchroTest extends ItopDataTestCase
|
||||
|
||||
$aKeys = ["creation", "update", "deletion"];
|
||||
foreach ($aKeys as $sKey){
|
||||
$this->assertContains("$sKey errors: 0", $sResultsViewable, "step $iRow : below res should contain '$sKey errors: 0': " . $sResultsViewable);
|
||||
$this->assertStringContainsString("$sKey errors: 0", $sResultsViewable, "step $iRow : below res should contain '$sKey errors: 0': " . $sResultsViewable);
|
||||
}
|
||||
|
||||
//N°3805 : potential javascript returned like
|
||||
|
||||
@@ -72,14 +72,14 @@ class RestTest extends ItopDataTestCase
|
||||
$aJson = json_decode($sOutputJson, true);
|
||||
|
||||
if ($this->iJsonDataMode === self::MODE['NO_JSONDATA']){
|
||||
$this->assertContains("3", "".$aJson['code'], $sOutputJson);
|
||||
$this->assertContains("Error: Missing parameter 'json_data'", "".$aJson['message'], $sOutputJson);
|
||||
$this->assertStringContainsString("3", "".$aJson['code'], $sOutputJson);
|
||||
$this->assertStringContainsString("Error: Missing parameter 'json_data'", "".$aJson['message'], $sOutputJson);
|
||||
return;
|
||||
}
|
||||
|
||||
$this->assertContains("0", "".$aJson['code'], $sOutputJson);
|
||||
$this->assertStringContainsString("0", "".$aJson['code'], $sOutputJson);
|
||||
$sUserRequestKey = $this->array_key_first($aJson['objects']);
|
||||
$this->assertContains('UserRequest::', $sUserRequestKey);
|
||||
$this->assertStringContainsString('UserRequest::', $sUserRequestKey);
|
||||
$iId = $aJson['objects'][$sUserRequestKey]['key'];
|
||||
$sExpectedJsonOuput=<<<JSON
|
||||
{"objects":{"UserRequest::$iId":{"code":0,"message":"created","class":"UserRequest","key":$iId,"fields":{"id":$iId}}},"code":0,"message":null}
|
||||
@@ -126,14 +126,14 @@ JSON;
|
||||
$aJson = json_decode($sOuputJson, true);
|
||||
|
||||
if ($this->iJsonDataMode === self::MODE['NO_JSONDATA']){
|
||||
$this->assertContains("3", "".$aJson['code'], $sOuputJson);
|
||||
$this->assertContains("Error: Missing parameter 'json_data'", "".$aJson['message'], $sOuputJson);
|
||||
$this->assertStringContainsString("3", "".$aJson['code'], $sOuputJson);
|
||||
$this->assertStringContainsString("Error: Missing parameter 'json_data'", "".$aJson['message'], $sOuputJson);
|
||||
return;
|
||||
}
|
||||
|
||||
$this->assertContains("0", "".$aJson['code'], $sOuputJson);
|
||||
$this->assertStringContainsString("0", "".$aJson['code'], $sOuputJson);
|
||||
$sUserRequestKey = $this->array_key_first($aJson['objects']);
|
||||
$this->assertContains('UserRequest::', $sUserRequestKey);
|
||||
$this->assertStringContainsString('UserRequest::', $sUserRequestKey);
|
||||
$iId = $aJson['objects'][$sUserRequestKey]['key'];
|
||||
|
||||
//update ticket
|
||||
@@ -165,21 +165,21 @@ JSON;
|
||||
$aJson = json_decode($sOuputJson, true);
|
||||
|
||||
if ($this->iJsonDataMode === self::MODE['NO_JSONDATA']){
|
||||
$this->assertContains("3", "".$aJson['code'], $sOuputJson);
|
||||
$this->assertContains("Error: Missing parameter 'json_data'", "".$aJson['message'], $sOuputJson);
|
||||
$this->assertStringContainsString("3", "".$aJson['code'], $sOuputJson);
|
||||
$this->assertStringContainsString("Error: Missing parameter 'json_data'", "".$aJson['message'], $sOuputJson);
|
||||
return;
|
||||
}
|
||||
|
||||
$this->assertContains("0", "".$aJson['code'], $sOuputJson);
|
||||
$this->assertStringContainsString("0", "".$aJson['code'], $sOuputJson);
|
||||
$sUserRequestKey = $this->array_key_first($aJson['objects']);
|
||||
$this->assertContains('UserRequest::', $sUserRequestKey);
|
||||
$this->assertStringContainsString('UserRequest::', $sUserRequestKey);
|
||||
$iId = $aJson['objects'][$sUserRequestKey]['key'];
|
||||
|
||||
//delete ticket
|
||||
$sExpectedJsonOuput=<<<JSON
|
||||
{"objects":{"UserRequest::$iId"
|
||||
JSON;
|
||||
$this->assertContains($sExpectedJsonOuput, $this->DeleteTicketFromApi($iId));
|
||||
$this->assertStringContainsString($sExpectedJsonOuput, $this->DeleteTicketFromApi($iId));
|
||||
|
||||
$sExpectedJsonOuput=<<<JSON
|
||||
{"objects":null,"code":0,"message":"Found: 0"}
|
||||
|
||||
Reference in New Issue
Block a user