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/CourseBundle/Repository/CGroupCategoryRepositoryTes...

58 lines
1.7 KiB

4 years ago
<?php
declare(strict_types=1);
/* For licensing terms, see /license.txt */
namespace Chamilo\Tests\CourseBundle\Repository;
4 years ago
use Chamilo\CoreBundle\Repository\Node\CourseRepository;
4 years ago
use Chamilo\CourseBundle\Entity\CGroupCategory;
use Chamilo\CourseBundle\Repository\CGroupCategoryRepository;
use Chamilo\Tests\AbstractApiTest;
use Chamilo\Tests\ChamiloTestTrait;
class CGroupCategoryRepositoryTest extends AbstractApiTest
{
use ChamiloTestTrait;
public function testCreate(): void
{
$em = $this->getEntityManager();
4 years ago
$categoryRepo = self::getContainer()->get(CGroupCategoryRepository::class);
$courseRepo = self::getContainer()->get(CourseRepository::class);
4 years ago
$course = $this->createCourse('new');
$teacher = $this->createUser('teacher');
4 years ago
$category = (new CGroupCategory())
4 years ago
->setTitle('category')
->setParent($course)
->setCreator($teacher)
4 years ago
->setDescription('desc')
->setSelfRegAllowed(true)
->setSelfUnregAllowed(true)
->setAnnouncementsState(true)
->setCalendarState(true)
->setChatState(true)
->setDocState(true)
->setDocumentAccess(1)
->setForumState(true)
->setWikiState(true)
->setWorkState(true)
->setGroupsPerUser(10)
4 years ago
->setMaxStudent(100)
;
4 years ago
$this->assertHasNoEntityViolations($category);
$em->persist($category);
4 years ago
$em->flush();
4 years ago
$this->assertSame(1, $categoryRepo->count([]));
$categoryRepo->delete($category);
$this->assertSame(0, $categoryRepo->count([]));
$this->assertSame(1, $courseRepo->count([]));
4 years ago
}
}