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/CoreBundle/Repository/ResourceFactoryTest.php

39 lines
1.2 KiB

<?php
declare(strict_types=1);
/* For licensing terms, see /license.txt */
namespace Chamilo\Tests\CoreBundle\Repository;
use Chamilo\CoreBundle\Repository\ResourceFactory;
use Chamilo\CoreBundle\Repository\ResourceRepository;
use Chamilo\CourseBundle\Repository\CDocumentRepository;
use Chamilo\Tests\ChamiloTestTrait;
use InvalidArgumentException;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class ResourceFactoryTest extends WebTestCase
{
use ChamiloTestTrait;
public function testGetRepositoryService(): void
{
self::bootKernel();
$factory = self::getContainer()->get(ResourceFactory::class);
$this->expectException(InvalidArgumentException::class);
$factory->getRepositoryService('aaa', 'bbb');
$repository = $factory->getRepositoryService('document', 'files');
$this->assertInstanceOf(ResourceRepository::class, $repository);
$this->assertInstanceOf(CDocumentRepository::class, $repository);
$this->expectException(InvalidArgumentException::class);
$factory->getRepositoryService('document', 'xxx');
$this->expectException(InvalidArgumentException::class);
$factory->getRepositoryService('xxx', 'xxx');
}
}