Merge remote-tracking branch 'refs/remotes/origin/support/3.2' into develop

This commit is contained in:
jf-cbd
2024-07-04 11:01:53 +02:00
21 changed files with 272 additions and 172 deletions

View File

@@ -41,6 +41,7 @@ use Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenu;
use Combodo\iTop\Application\UI\Base\Component\Title\TitleUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Layout\Object\ObjectFactory;
use Combodo\iTop\Application\UI\Base\Layout\PageContent\PageContentFactory;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlockUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlockWithJSRefreshCallback;
use Combodo\iTop\Application\WebPage\iTopWebPage;
use LoginWebPage;
@@ -355,6 +356,22 @@ $oDashletFieldset2->AddSubBlock($oDashletField4);
$oDashletFieldset2->AddSubBlock($oDashletField5);
$oDashletFieldset2->AddSubBlock($oDashletField6);
/////////
// Code
/////////
$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Code examples (MakeForCode)', 2 ));
$oCode1 = UIContentBlockUIBlockFactory::MakeForCode('function mean(int $a, int $b) {
return ($a + $b)/2
}');
$oPage->AddUiBlock($oCode1);
$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Code examples (MakeForPreformatted)', 2 ));
$oCode2 = UIContentBlockUIBlockFactory::MakeForPreformatted('function mean(int $a, int $b) {
return ($a + $b)/2
}');
$oPage->AddUiBlock($oCode2);
/////////
// Pill
/////////

View File

@@ -127,7 +127,10 @@ abstract class ItopDataTestCase extends ItopTestCase
}
if (static::CREATE_TEST_ORG)
{
$this->GivenTestOrganization();
// Create a specific organization for the tests
$this->iTestOrgId = $this->GivenObjectInDB('Organization', [
'name' => 'UnitTestOrganization',
]);
}
$oConfig = MetaModel::GetConfig();
@@ -1175,29 +1178,6 @@ abstract class ItopDataTestCase extends ItopTestCase
return $iKey;
}
/**
* Create an Organization in database
*
* @param string $sName
*
* @throws Exception
*/
protected function GivenOrganization($sName): string
{
$sId = $this->GivenObjectInDB('Organization', [
'name' => $sName,
]);
$this->debug("Created Organization $sName");
return $sId;
}
protected function GivenTestOrganization(): void
{
// Create a specific organization for the tests
$this->iTestOrgId = $this->GivenOrganization('UnitTestOrganization');
}
/**
* Create a Farm in database
*

View File

@@ -46,17 +46,21 @@ class GivenObjectInDBTest extends ItopDataTestCase
'first_name' => 'John',
]);
$iRole = $this->GivenObjectInDB('ContactType', [
'name' => 'The Boss',
]);
$iTeam = $this->GivenObjectInDB('Team', [
'name' => 'The A Team',
'persons_list' => [
"person_id:$iPerson;role_id:1"
"person_id:$iPerson;role_id:$iRole"
],
]);
$oSet = new \DBObjectSet(\DBObjectSearch::FromOQL("SELECT lnkPersonToTeam AS lnk WHERE lnk.team_id = $iTeam AND lnk.person_id = $iPerson"));
$this->assertEquals(1, $oSet->Count(), "The link between the team and the person should be there");
$oLnk = $oSet->Fetch();
$this->assertEquals(1, $oLnk->Get('role_id'), "The role should be correctly set");
$this->assertEquals($iRole, $oLnk->Get('role_id'), "The role should be correctly set");
}
public function testItShouldFailExplicitlyWhenAnAttributeCodeIsUnknown()