parent
c0fa511d5e
commit
1553b78c7c
@ -0,0 +1,40 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\Tests\CourseBundle\Repository; |
||||
|
||||
use Chamilo\CourseBundle\Entity\CLp; |
||||
use Chamilo\CourseBundle\Repository\CLpRepository; |
||||
use Chamilo\Tests\AbstractApiTest; |
||||
use Chamilo\Tests\ChamiloTestTrait; |
||||
|
||||
class CLpRepositoryTest extends AbstractApiTest |
||||
{ |
||||
use ChamiloTestTrait; |
||||
|
||||
public function testCreate(): void |
||||
{ |
||||
self::bootKernel(); |
||||
|
||||
$em = self::getContainer()->get('doctrine')->getManager(); |
||||
$repo = self::getContainer()->get(CLpRepository::class); |
||||
|
||||
$course = $this->createCourse('new'); |
||||
$teacher = $this->createUser('teacher'); |
||||
|
||||
$item = (new CLp()) |
||||
->setName('Group') |
||||
->setParent($course) |
||||
->setCreator($teacher) |
||||
->setLpType(CLp::LP_TYPE) |
||||
; |
||||
$this->assertHasNoEntityViolations($item); |
||||
$em->persist($item); |
||||
$em->flush(); |
||||
|
||||
$this->assertSame(1, $repo->count([])); |
||||
} |
||||
} |
||||
@ -0,0 +1,32 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\Tests\CourseBundle\Settings; |
||||
|
||||
use Chamilo\CourseBundle\Settings\SettingsCourseManager; |
||||
use Chamilo\Tests\AbstractApiTest; |
||||
use Chamilo\Tests\ChamiloTestTrait; |
||||
use InvalidArgumentException; |
||||
|
||||
class SettingsCourseManagerTest extends AbstractApiTest |
||||
{ |
||||
use ChamiloTestTrait; |
||||
|
||||
public function testCreate(): void |
||||
{ |
||||
self::bootKernel(); |
||||
|
||||
$em = self::getContainer()->get('doctrine')->getManager(); |
||||
$settingsManager = self::getContainer()->get(SettingsCourseManager::class); |
||||
|
||||
$this->expectException(InvalidArgumentException::class); |
||||
$settingsManager->getSetting('institution'); |
||||
|
||||
$platform = $settingsManager->getSetting('platform.institution'); |
||||
$this->assertNotEmpty($platform); |
||||
$this->assertTrue(\count($settingsManager->getSchemas()) > 0); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue