mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 06:28:46 +02:00
N°8796 - Add PHP code style validation in iTop and extensions - format whole code base
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -15,7 +16,7 @@ use Combodo\iTop\Test\UnitTest\ItopTestCase;
|
||||
|
||||
class FieldTest extends ItopTestCase
|
||||
{
|
||||
public function testIsValidationDisabled(): void
|
||||
public function testIsValidationDisabled(): void
|
||||
{
|
||||
$oField = new StringField('test');
|
||||
$oField->SetCurrentValue('toto@johny.invalid');
|
||||
@@ -101,7 +102,8 @@ class FieldTest extends ItopTestCase
|
||||
$this->assertCount(0, $oSubFormField->GetErrorMessages());
|
||||
}
|
||||
|
||||
public function testRemoveValidatorsOfClass(): void {
|
||||
public function testRemoveValidatorsOfClass(): void
|
||||
{
|
||||
$oField = new StringField('test');
|
||||
|
||||
$this->assertCount(0, $oField->GetValidators());
|
||||
@@ -124,4 +126,4 @@ class FieldTest extends ItopTestCase
|
||||
$oField->RemoveValidatorsOfClass(CustomRegexpValidator::class);
|
||||
$this->assertCount(1, $oField->GetValidators());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -11,8 +12,10 @@ use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
|
||||
use ormLinkSet;
|
||||
use Person;
|
||||
|
||||
class LinkedSetFieldTest extends ItopDataTestCase {
|
||||
public function testValidate(): void {
|
||||
class LinkedSetFieldTest extends ItopDataTestCase
|
||||
{
|
||||
public function testValidate(): void
|
||||
{
|
||||
$sLinkedClass = Ticket::class;
|
||||
$oLinkedSetField = new LinkedSetField('test');
|
||||
$oLinkedSetField->SetIndirect(false);
|
||||
@@ -37,4 +40,4 @@ class LinkedSetFieldTest extends ItopDataTestCase {
|
||||
$oUserRequest1->Set('title', '');
|
||||
$this->assertFalse($oLinkedSetField->Validate(), 'A set with existing objects and an invalid modification must be KO');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -104,4 +105,4 @@ class MultipleChoicesFieldTest extends ItopTestCase
|
||||
$this->assertCount(1, $oMultipleChoicesField->GetErrorMessages());
|
||||
$this->assertStringContainsString($sNonExistingValue, $oMultipleChoicesField->GetErrorMessages()[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -12,8 +13,10 @@ use ContextTag;
|
||||
use DBObjectSearch;
|
||||
use Organization;
|
||||
|
||||
class SelectObjectFieldTest extends ItopDataTestCase {
|
||||
public function testValidate(): void {
|
||||
class SelectObjectFieldTest extends ItopDataTestCase
|
||||
{
|
||||
public function testValidate(): void
|
||||
{
|
||||
$oSelectObjectField = new SelectObjectField('test');
|
||||
$oSelectObjectField->SetSearch(DBObjectSearch::FromOQL('SELECT '.Organization::class));
|
||||
|
||||
@@ -26,7 +29,8 @@ class SelectObjectFieldTest extends ItopDataTestCase {
|
||||
$this->ValidateSelectObjectField($oSelectObjectField);
|
||||
}
|
||||
|
||||
private function ValidateSelectObjectField(SelectObjectField $oSelectObjectField): void {
|
||||
private function ValidateSelectObjectField(SelectObjectField $oSelectObjectField): void
|
||||
{
|
||||
$oSelectObjectField->SetCurrentValue(null);
|
||||
$this->assertTrue($oSelectObjectField->Validate(), 'No value must be valid');
|
||||
|
||||
@@ -40,4 +44,4 @@ class SelectObjectFieldTest extends ItopDataTestCase {
|
||||
$this->assertCount(1, $oSelectObjectField->GetErrorMessages());
|
||||
$this->assertStringContainsString($sNonExistingOrganizationId, $oSelectObjectField->GetErrorMessages()[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -28,4 +29,4 @@ class ValidatorTest extends ItopTestCase
|
||||
$this->assertCount(1, $oField->GetErrorMessages());
|
||||
$this->assertStringContainsString(MandatoryValidator::DEFAULT_ERROR_MESSAGE, $oField->GetErrorMessages()[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user