Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chamilo-lms/tests/CoreBundle/Repository/SettingsCurrentRepositoryTe...

53 lines
1.5 KiB

<?php
declare(strict_types=1);
/* For licensing terms, see /license.txt */
namespace Chamilo\Tests\CoreBundle\Repository;
use Chamilo\CoreBundle\Entity\SettingsCurrent;
4 years ago
use Chamilo\CoreBundle\Entity\SettingsOptions;
use Chamilo\CoreBundle\Repository\SettingsCurrentRepository;
use Chamilo\Tests\AbstractApiTest;
use Chamilo\Tests\ChamiloTestTrait;
class SettingsCurrentRepositoryTest extends AbstractApiTest
{
use ChamiloTestTrait;
public function testCreate(): void
{
$em = $this->getEntityManager();
$repo = self::getContainer()->get(SettingsCurrentRepository::class);
$count = $repo->count([]);
4 years ago
$setting = (new SettingsCurrent())
->setTitle('test')
->setVariable('test')
->setUrl($this->getAccessUrl())
->setCategory('cat')
->setAccessUrlChangeable(1)
4 years ago
->setSubkey('sub')
->setType('type')
->setComment('comment')
->setSubkeytext('setSubkeytext')
->setAccessUrlLocked(1)
;
4 years ago
$this->assertHasNoEntityViolations($setting);
$em->persist($setting);
$option = (new SettingsOptions())
->setValue('value')
->setDisplayText('option1')
->setVariable('variable')
;
$em->persist($option);
$this->assertHasNoEntityViolations($option);
$em->flush();
// By default, there's a root branch.
$this->assertSame($count + 1, $repo->count([]));
}
}