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.
41 lines
1.1 KiB
41 lines
1.1 KiB
![]()
4 years ago
|
<?php
|
||
|
|
||
|
declare(strict_types=1);
|
||
|
|
||
|
/* For licensing terms, see /license.txt */
|
||
|
|
||
|
namespace Chamilo\Tests\CourseBundle\Repository;
|
||
|
|
||
|
use Chamilo\CourseBundle\Entity\CExerciseCategory;
|
||
|
use Chamilo\CourseBundle\Repository\CExerciseCategoryRepository;
|
||
|
use Chamilo\Tests\AbstractApiTest;
|
||
|
use Chamilo\Tests\ChamiloTestTrait;
|
||
|
|
||
|
class CExerciseCategoryRepositoryTest extends AbstractApiTest
|
||
|
{
|
||
|
use ChamiloTestTrait;
|
||
|
|
||
|
public function testCreate(): void
|
||
|
{
|
||
|
$em = $this->getEntityManager();
|
||
|
$repo = self::getContainer()->get(CExerciseCategoryRepository::class);
|
||
|
|
||
|
$course = $this->createCourse('new');
|
||
|
$teacher = $this->createUser('teacher');
|
||
|
|
||
|
$item = (new CExerciseCategory())
|
||
|
->setName('cat')
|
||
|
->setDescription('des')
|
||
|
->setCourse($course)
|
||
|
->setParent($course)
|
||
|
->setCreator($teacher)
|
||
|
;
|
||
|
$this->assertHasNoEntityViolations($item);
|
||
|
$em->persist($item);
|
||
|
$em->flush();
|
||
|
|
||
|
$this->assertSame('cat', (string) $item);
|
||
|
$this->assertSame(1, $repo->count([]));
|
||
|
}
|
||
|
}
|