|
|
|
|
@ -15,7 +15,7 @@ class CLpRepositoryTest extends AbstractApiTest |
|
|
|
|
{ |
|
|
|
|
use ChamiloTestTrait; |
|
|
|
|
|
|
|
|
|
public function testCreate(): void |
|
|
|
|
public function testCreateLp(): void |
|
|
|
|
{ |
|
|
|
|
self::bootKernel(); |
|
|
|
|
|
|
|
|
|
@ -37,5 +37,30 @@ class CLpRepositoryTest extends AbstractApiTest |
|
|
|
|
$this->assertSame(1, $lp->getItems()->count()); |
|
|
|
|
$this->assertSame('lp', (string) $lp); |
|
|
|
|
$this->assertSame(1, $repo->count([])); |
|
|
|
|
|
|
|
|
|
$link = $repo->getLink($lp, $this->getContainer()->get('router')); |
|
|
|
|
$this->assertSame('/main/lp/lp_controller.php?lp_id='.$lp->getIid().'&action=view', $link); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testFindAllByCourse(): void |
|
|
|
|
{ |
|
|
|
|
self::bootKernel(); |
|
|
|
|
|
|
|
|
|
$repo = self::getContainer()->get(CLpRepository::class); |
|
|
|
|
|
|
|
|
|
$course = $this->createCourse('new'); |
|
|
|
|
$teacher = $this->createUser('teacher'); |
|
|
|
|
|
|
|
|
|
$lp = (new CLp()) |
|
|
|
|
->setName('lp') |
|
|
|
|
->setParent($course) |
|
|
|
|
->setCreator($teacher) |
|
|
|
|
->setLpType(CLp::LP_TYPE) |
|
|
|
|
->addCourseLink($course) |
|
|
|
|
; |
|
|
|
|
$repo->createLp($lp); |
|
|
|
|
|
|
|
|
|
$qb = $repo->findAllByCourse($course); |
|
|
|
|
$this->assertSame(1, \count($qb->getQuery()->getResult())); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|