parent
6d015e52ec
commit
1bbb516973
@ -0,0 +1,48 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
declare(strict_types=1); |
||||||
|
|
||||||
|
/* For licensing terms, see /license.txt */ |
||||||
|
|
||||||
|
namespace Chamilo\Tests\CourseBundle\Repository; |
||||||
|
|
||||||
|
use Chamilo\CourseBundle\Entity\CForum; |
||||||
|
use Chamilo\CourseBundle\Entity\CForumCategory; |
||||||
|
use Chamilo\CourseBundle\Entity\CLp; |
||||||
|
use Chamilo\CourseBundle\Entity\CQuiz; |
||||||
|
use Chamilo\CourseBundle\Entity\CSurvey; |
||||||
|
use Chamilo\CourseBundle\Repository\CForumCategoryRepository; |
||||||
|
use Chamilo\CourseBundle\Repository\CForumRepository; |
||||||
|
use Chamilo\CourseBundle\Repository\CLpRepository; |
||||||
|
use Chamilo\CourseBundle\Repository\CQuizRepository; |
||||||
|
use Chamilo\CourseBundle\Repository\CSurveyRepository; |
||||||
|
use Chamilo\Tests\AbstractApiTest; |
||||||
|
use Chamilo\Tests\ChamiloTestTrait; |
||||||
|
|
||||||
|
class CForumCategoryRepositoryTest extends AbstractApiTest |
||||||
|
{ |
||||||
|
use ChamiloTestTrait; |
||||||
|
|
||||||
|
public function testCreate(): void |
||||||
|
{ |
||||||
|
self::bootKernel(); |
||||||
|
|
||||||
|
$em = $this->getManager(); |
||||||
|
$repo = self::getContainer()->get(CForumCategoryRepository::class); |
||||||
|
|
||||||
|
$course = $this->createCourse('new'); |
||||||
|
$teacher = $this->createUser('teacher'); |
||||||
|
|
||||||
|
$item = (new CForumCategory()) |
||||||
|
->setCatTitle('cat') |
||||||
|
->setParent($course) |
||||||
|
->setCreator($teacher) |
||||||
|
; |
||||||
|
$this->assertHasNoEntityViolations($item); |
||||||
|
$em->persist($item); |
||||||
|
$em->flush(); |
||||||
|
|
||||||
|
$this->assertSame('cat', (string) $item); |
||||||
|
$this->assertSame(1, $repo->count([])); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,46 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
declare(strict_types=1); |
||||||
|
|
||||||
|
/* For licensing terms, see /license.txt */ |
||||||
|
|
||||||
|
namespace Chamilo\Tests\CourseBundle\Repository; |
||||||
|
|
||||||
|
use Chamilo\CourseBundle\Entity\CForum; |
||||||
|
use Chamilo\CourseBundle\Entity\CLp; |
||||||
|
use Chamilo\CourseBundle\Entity\CQuiz; |
||||||
|
use Chamilo\CourseBundle\Entity\CSurvey; |
||||||
|
use Chamilo\CourseBundle\Repository\CForumRepository; |
||||||
|
use Chamilo\CourseBundle\Repository\CLpRepository; |
||||||
|
use Chamilo\CourseBundle\Repository\CQuizRepository; |
||||||
|
use Chamilo\CourseBundle\Repository\CSurveyRepository; |
||||||
|
use Chamilo\Tests\AbstractApiTest; |
||||||
|
use Chamilo\Tests\ChamiloTestTrait; |
||||||
|
|
||||||
|
class CForumRepositoryTest extends AbstractApiTest |
||||||
|
{ |
||||||
|
use ChamiloTestTrait; |
||||||
|
|
||||||
|
public function testCreate(): void |
||||||
|
{ |
||||||
|
self::bootKernel(); |
||||||
|
|
||||||
|
$em = $this->getManager(); |
||||||
|
$repo = self::getContainer()->get(CForumRepository::class); |
||||||
|
|
||||||
|
$course = $this->createCourse('new'); |
||||||
|
$teacher = $this->createUser('teacher'); |
||||||
|
|
||||||
|
$item = (new CForum()) |
||||||
|
->setForumTitle('forum') |
||||||
|
->setParent($course) |
||||||
|
->setCreator($teacher) |
||||||
|
; |
||||||
|
$this->assertHasNoEntityViolations($item); |
||||||
|
$em->persist($item); |
||||||
|
$em->flush(); |
||||||
|
|
||||||
|
$this->assertSame('forum', (string) $item); |
||||||
|
$this->assertSame(1, $repo->count([])); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,47 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
declare(strict_types=1); |
||||||
|
|
||||||
|
/* For licensing terms, see /license.txt */ |
||||||
|
|
||||||
|
namespace Chamilo\Tests\CourseBundle\Repository; |
||||||
|
|
||||||
|
use Chamilo\CourseBundle\Entity\CLink; |
||||||
|
use Chamilo\CourseBundle\Entity\CLinkCategory; |
||||||
|
use Chamilo\CourseBundle\Entity\CLp; |
||||||
|
use Chamilo\CourseBundle\Entity\CSurvey; |
||||||
|
use Chamilo\CourseBundle\Repository\CLinkCategoryRepository; |
||||||
|
use Chamilo\CourseBundle\Repository\CLinkRepository; |
||||||
|
use Chamilo\CourseBundle\Repository\CLpRepository; |
||||||
|
use Chamilo\CourseBundle\Repository\CSurveyRepository; |
||||||
|
use Chamilo\Tests\AbstractApiTest; |
||||||
|
use Chamilo\Tests\ChamiloTestTrait; |
||||||
|
|
||||||
|
class CLinkCategoryRepositoryTest extends AbstractApiTest |
||||||
|
{ |
||||||
|
use ChamiloTestTrait; |
||||||
|
|
||||||
|
public function testCreate(): void |
||||||
|
{ |
||||||
|
self::bootKernel(); |
||||||
|
|
||||||
|
$em = $this->getManager(); |
||||||
|
$repo = self::getContainer()->get(CLinkCategoryRepository::class); |
||||||
|
|
||||||
|
$course = $this->createCourse('new'); |
||||||
|
$teacher = $this->createUser('teacher'); |
||||||
|
|
||||||
|
$item = (new CLinkCategory()) |
||||||
|
->setCategoryTitle('cat') |
||||||
|
->setParent($course) |
||||||
|
->setCreator($teacher) |
||||||
|
; |
||||||
|
|
||||||
|
$this->assertHasNoEntityViolations($item); |
||||||
|
$em->persist($item); |
||||||
|
$em->flush(); |
||||||
|
|
||||||
|
$this->assertSame('cat', (string) $item); |
||||||
|
$this->assertSame(1, $repo->count([])); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,46 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
declare(strict_types=1); |
||||||
|
|
||||||
|
/* For licensing terms, see /license.txt */ |
||||||
|
|
||||||
|
namespace Chamilo\Tests\CourseBundle\Repository; |
||||||
|
|
||||||
|
use Chamilo\CourseBundle\Entity\CLink; |
||||||
|
use Chamilo\CourseBundle\Entity\CLp; |
||||||
|
use Chamilo\CourseBundle\Entity\CSurvey; |
||||||
|
use Chamilo\CourseBundle\Repository\CLinkRepository; |
||||||
|
use Chamilo\CourseBundle\Repository\CLpRepository; |
||||||
|
use Chamilo\CourseBundle\Repository\CSurveyRepository; |
||||||
|
use Chamilo\Tests\AbstractApiTest; |
||||||
|
use Chamilo\Tests\ChamiloTestTrait; |
||||||
|
|
||||||
|
class CLinkRepositoryTest extends AbstractApiTest |
||||||
|
{ |
||||||
|
use ChamiloTestTrait; |
||||||
|
|
||||||
|
public function testCreate(): void |
||||||
|
{ |
||||||
|
self::bootKernel(); |
||||||
|
|
||||||
|
$em = $this->getManager(); |
||||||
|
$repo = self::getContainer()->get(CLinkRepository::class); |
||||||
|
|
||||||
|
$course = $this->createCourse('new'); |
||||||
|
$teacher = $this->createUser('teacher'); |
||||||
|
|
||||||
|
$item = (new CLink()) |
||||||
|
->setUrl('https://chamilo.org') |
||||||
|
->setTitle('link') |
||||||
|
->setParent($course) |
||||||
|
->setCreator($teacher) |
||||||
|
; |
||||||
|
|
||||||
|
$this->assertHasNoEntityViolations($item); |
||||||
|
$em->persist($item); |
||||||
|
$em->flush(); |
||||||
|
|
||||||
|
$this->assertSame('link', (string) $item); |
||||||
|
$this->assertSame(1, $repo->count([])); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,44 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
declare(strict_types=1); |
||||||
|
|
||||||
|
/* For licensing terms, see /license.txt */ |
||||||
|
|
||||||
|
namespace Chamilo\Tests\CourseBundle\Repository; |
||||||
|
|
||||||
|
use Chamilo\CourseBundle\Entity\CLp; |
||||||
|
use Chamilo\CourseBundle\Entity\CQuiz; |
||||||
|
use Chamilo\CourseBundle\Entity\CSurvey; |
||||||
|
use Chamilo\CourseBundle\Repository\CLpRepository; |
||||||
|
use Chamilo\CourseBundle\Repository\CQuizRepository; |
||||||
|
use Chamilo\CourseBundle\Repository\CSurveyRepository; |
||||||
|
use Chamilo\Tests\AbstractApiTest; |
||||||
|
use Chamilo\Tests\ChamiloTestTrait; |
||||||
|
|
||||||
|
class CQuizRepositoryTest extends AbstractApiTest |
||||||
|
{ |
||||||
|
use ChamiloTestTrait; |
||||||
|
|
||||||
|
public function testCreate(): void |
||||||
|
{ |
||||||
|
self::bootKernel(); |
||||||
|
|
||||||
|
$em = $this->getManager(); |
||||||
|
$repo = self::getContainer()->get(CQuizRepository::class); |
||||||
|
|
||||||
|
$course = $this->createCourse('new'); |
||||||
|
$teacher = $this->createUser('teacher'); |
||||||
|
|
||||||
|
$item = (new CQuiz()) |
||||||
|
->setTitle('exercise') |
||||||
|
->setParent($course) |
||||||
|
->setCreator($teacher) |
||||||
|
; |
||||||
|
$this->assertHasNoEntityViolations($item); |
||||||
|
$em->persist($item); |
||||||
|
$em->flush(); |
||||||
|
|
||||||
|
$this->assertSame('exercise', (string) $item); |
||||||
|
$this->assertSame(1, $repo->count([])); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,48 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
declare(strict_types=1); |
||||||
|
|
||||||
|
/* For licensing terms, see /license.txt */ |
||||||
|
|
||||||
|
namespace Chamilo\Tests\CourseBundle\Repository; |
||||||
|
|
||||||
|
use Chamilo\CourseBundle\Entity\CLp; |
||||||
|
use Chamilo\CourseBundle\Entity\CQuiz; |
||||||
|
use Chamilo\CourseBundle\Entity\CStudentPublication; |
||||||
|
use Chamilo\CourseBundle\Entity\CSurvey; |
||||||
|
use Chamilo\CourseBundle\Repository\CLpRepository; |
||||||
|
use Chamilo\CourseBundle\Repository\CQuizRepository; |
||||||
|
use Chamilo\CourseBundle\Repository\CStudentPublicationRepository; |
||||||
|
use Chamilo\CourseBundle\Repository\CSurveyRepository; |
||||||
|
use Chamilo\Tests\AbstractApiTest; |
||||||
|
use Chamilo\Tests\ChamiloTestTrait; |
||||||
|
|
||||||
|
class CStudentPublicationRepositoryTest extends AbstractApiTest |
||||||
|
{ |
||||||
|
use ChamiloTestTrait; |
||||||
|
|
||||||
|
public function testCreate(): void |
||||||
|
{ |
||||||
|
self::bootKernel(); |
||||||
|
|
||||||
|
$em = $this->getManager(); |
||||||
|
$repo = self::getContainer()->get(CStudentPublicationRepository::class); |
||||||
|
|
||||||
|
$course = $this->createCourse('new'); |
||||||
|
$teacher = $this->createUser('teacher'); |
||||||
|
|
||||||
|
$item = (new CStudentPublication()) |
||||||
|
->setTitle('publi') |
||||||
|
->setParent($course) |
||||||
|
->setFiletype('folder') |
||||||
|
->setWeight(100) |
||||||
|
->setCreator($teacher) |
||||||
|
; |
||||||
|
$this->assertHasNoEntityViolations($item); |
||||||
|
$em->persist($item); |
||||||
|
$em->flush(); |
||||||
|
|
||||||
|
$this->assertSame('publi', (string) $item); |
||||||
|
$this->assertSame(1, $repo->count([])); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,44 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
declare(strict_types=1); |
||||||
|
|
||||||
|
/* For licensing terms, see /license.txt */ |
||||||
|
|
||||||
|
namespace Chamilo\Tests\CourseBundle\Repository; |
||||||
|
|
||||||
|
use Chamilo\CourseBundle\Entity\CLp; |
||||||
|
use Chamilo\CourseBundle\Entity\CSurvey; |
||||||
|
use Chamilo\CourseBundle\Repository\CLpRepository; |
||||||
|
use Chamilo\CourseBundle\Repository\CSurveyRepository; |
||||||
|
use Chamilo\Tests\AbstractApiTest; |
||||||
|
use Chamilo\Tests\ChamiloTestTrait; |
||||||
|
|
||||||
|
class CSurveyRepositoryTest extends AbstractApiTest |
||||||
|
{ |
||||||
|
use ChamiloTestTrait; |
||||||
|
|
||||||
|
public function testCreate(): void |
||||||
|
{ |
||||||
|
self::bootKernel(); |
||||||
|
|
||||||
|
$em = $this->getManager(); |
||||||
|
$repo = self::getContainer()->get(CSurveyRepository::class); |
||||||
|
|
||||||
|
$course = $this->createCourse('new'); |
||||||
|
$teacher = $this->createUser('teacher'); |
||||||
|
|
||||||
|
$item = (new CSurvey()) |
||||||
|
->setTitle('survey') |
||||||
|
->setCode('survey') |
||||||
|
->setParent($course) |
||||||
|
->setCreator($teacher) |
||||||
|
; |
||||||
|
|
||||||
|
$this->assertHasNoEntityViolations($item); |
||||||
|
$em->persist($item); |
||||||
|
$em->flush(); |
||||||
|
|
||||||
|
$this->assertSame('survey', (string) $item); |
||||||
|
$this->assertSame(1, $repo->count([])); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,46 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
declare(strict_types=1); |
||||||
|
|
||||||
|
/* For licensing terms, see /license.txt */ |
||||||
|
|
||||||
|
namespace Chamilo\Tests\CourseBundle\Repository; |
||||||
|
|
||||||
|
use Chamilo\CourseBundle\Entity\CLp; |
||||||
|
use Chamilo\CourseBundle\Entity\CQuiz; |
||||||
|
use Chamilo\CourseBundle\Entity\CSurvey; |
||||||
|
use Chamilo\CourseBundle\Entity\CThematic; |
||||||
|
use Chamilo\CourseBundle\Repository\CLpRepository; |
||||||
|
use Chamilo\CourseBundle\Repository\CQuizRepository; |
||||||
|
use Chamilo\CourseBundle\Repository\CSurveyRepository; |
||||||
|
use Chamilo\CourseBundle\Repository\CThematicRepository; |
||||||
|
use Chamilo\Tests\AbstractApiTest; |
||||||
|
use Chamilo\Tests\ChamiloTestTrait; |
||||||
|
|
||||||
|
class CThematicRepositoryTest extends AbstractApiTest |
||||||
|
{ |
||||||
|
use ChamiloTestTrait; |
||||||
|
|
||||||
|
public function testCreate(): void |
||||||
|
{ |
||||||
|
self::bootKernel(); |
||||||
|
|
||||||
|
$em = $this->getManager(); |
||||||
|
$repo = self::getContainer()->get(CThematicRepository::class); |
||||||
|
|
||||||
|
$course = $this->createCourse('new'); |
||||||
|
$teacher = $this->createUser('teacher'); |
||||||
|
|
||||||
|
$item = (new CThematic()) |
||||||
|
->setTitle('thematic') |
||||||
|
->setParent($course) |
||||||
|
->setCreator($teacher) |
||||||
|
; |
||||||
|
$this->assertHasNoEntityViolations($item); |
||||||
|
$em->persist($item); |
||||||
|
$em->flush(); |
||||||
|
|
||||||
|
$this->assertSame('thematic', (string) $item); |
||||||
|
$this->assertSame(1, $repo->count([])); |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue