parent
cfd5371c7e
commit
139f7943b0
@ -0,0 +1,40 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\Tests\CourseBundle\Repository; |
||||
|
||||
use Chamilo\CourseBundle\Entity\CGroup; |
||||
use Chamilo\CourseBundle\Repository\CGroupRepository; |
||||
use Chamilo\Tests\AbstractApiTest; |
||||
use Chamilo\Tests\ChamiloTestTrait; |
||||
|
||||
class CGroupRepositoryTest extends AbstractApiTest |
||||
{ |
||||
use ChamiloTestTrait; |
||||
|
||||
public function testCreate(): void |
||||
{ |
||||
self::bootKernel(); |
||||
|
||||
$em = self::getContainer()->get('doctrine')->getManager(); |
||||
$repo = self::getContainer()->get(CGroupRepository::class); |
||||
|
||||
$course = $this->createCourse('new'); |
||||
$teacher = $this->createUser('teacher'); |
||||
|
||||
$item = (new CGroup()) |
||||
->setName('Group') |
||||
->setParent($course) |
||||
->setCreator($teacher) |
||||
->setMaxStudent(100) |
||||
; |
||||
$this->assertHasNoEntityViolations($item); |
||||
$em->persist($item); |
||||
$em->flush(); |
||||
|
||||
$this->assertSame(1, $repo->count([])); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue