Tests: Minor refactor code

pull/3959/head
Julio 3 years ago
parent f97c959b9c
commit 22d3289074
  1. 1
      src/CoreBundle/Repository/ExtraFieldRelTagRepository.php
  2. 2
      tests/CoreBundle/Api/UserRelUserTest.php
  3. 2
      tests/CoreBundle/Repository/CourseCategoryRepositoryTest.php
  4. 2
      tests/CoreBundle/Repository/ExtraFieldRepositoryTest.php
  5. 2
      tests/CoreBundle/Repository/GradeBookCategoryRepositoryTest.php
  6. 2
      tests/CoreBundle/Repository/GroupRepositoryTest.php
  7. 10
      tests/CoreBundle/Repository/MessageRepositoryTest.php
  8. 2
      tests/CoreBundle/Repository/Node/SessionRepositoryTest.php
  9. 2
      tests/CoreBundle/Repository/Node/UserRepositoryTest.php
  10. 2
      tests/CoreBundle/Repository/SessionRepositoryTest.php
  11. 4
      tests/CoreBundle/Repository/SkillRepositoryTest.php
  12. 8
      tests/CourseBundle/Repository/CForumCategoryRepositoryTest.php
  13. 6
      tests/CourseBundle/Repository/CForumRepositoryTest.php
  14. 6
      tests/CourseBundle/Repository/CLinkCategoryRepositoryTest.php
  15. 4
      tests/CourseBundle/Repository/CLinkRepositoryTest.php
  16. 4
      tests/CourseBundle/Repository/CQuizRepositoryTest.php
  17. 6
      tests/CourseBundle/Repository/CStudentPublicationRepositoryTest.php
  18. 2
      tests/CourseBundle/Repository/CSurveyRepositoryTest.php
  19. 6
      tests/CourseBundle/Repository/CThematicRepositoryTest.php
  20. 2
      tests/CourseBundle/Settings/SettingsCourseManagerTest.php

@ -9,7 +9,6 @@ namespace Chamilo\CoreBundle\Repository;
use Chamilo\CoreBundle\Entity\ExtraField;
use Chamilo\CoreBundle\Entity\ExtraFieldRelTag;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\Query\Expr\Join;
use Doctrine\Persistence\ManagerRegistry;
/**

@ -23,7 +23,7 @@ class UserRelUserTest extends AbstractApiTest
$user = $this->createUser('user');
$friend = $this->createUser('friend');
$em = self::getContainer()->get('doctrine')->getManager();
$em = $this->getManager();
$userRepo = self::getContainer()->get(UserRepository::class);
$tokenTest = $this->getUserToken(

@ -19,7 +19,7 @@ class CourseCategoryRepositoryTest extends AbstractApiTest
{
self::bootKernel();
$em = self::getContainer()->get('doctrine')->getManager();
$em = $this->getManager();
$repo = self::getContainer()->get(CourseCategoryRepository::class);
$item = (new CourseCategory())

@ -19,7 +19,7 @@ class ExtraFieldRepositoryTest extends AbstractApiTest
{
self::bootKernel();
$em = self::getContainer()->get('doctrine')->getManager();
$em = $this->getManager();
$repo = self::getContainer()->get(ExtraFieldRepository::class);
$defaultCount = $repo->count([]);

@ -19,7 +19,7 @@ class GradeBookCategoryRepositoryTest extends AbstractApiTest
{
self::bootKernel();
$em = self::getContainer()->get('doctrine')->getManager();
$em = $this->getManager();
$repo = self::getContainer()->get(GradeBookCategoryRepository::class);
$course = $this->createCourse('new');

@ -19,7 +19,7 @@ class GroupRepositoryTest extends AbstractApiTest
{
self::bootKernel();
$em = self::getContainer()->get('doctrine')->getManager();
$em = $this->getManager();
$repo = self::getContainer()->get(GroupRepository::class);
$defaultGroups = $repo->count([]);
$item = (new Group('new_group'))

@ -27,7 +27,7 @@ class MessageRepositoryTest extends AbstractApiTest
{
self::bootKernel();
$em = self::getContainer()->get('doctrine')->getManager();
$em = $this->getManager();
$messageRepo = self::getContainer()->get(MessageRepository::class);
$userRepo = self::getContainer()->get(UserRepository::class);
@ -73,7 +73,7 @@ class MessageRepositoryTest extends AbstractApiTest
{
self::bootKernel();
$em = self::getContainer()->get('doctrine')->getManager();
$em = $this->getManager();
$messageTagRepo = self::getContainer()->get(MessageTagRepository::class);
$messageRepo = self::getContainer()->get(MessageRepository::class);
@ -158,7 +158,7 @@ class MessageRepositoryTest extends AbstractApiTest
{
self::bootKernel();
$em = self::getContainer()->get('doctrine')->getManager();
$em = $this->getManager();
$messageAttachmentRepo = self::getContainer()->get(MessageAttachmentRepository::class);
$messageRepo = self::getContainer()->get(MessageRepository::class);
@ -199,7 +199,7 @@ class MessageRepositoryTest extends AbstractApiTest
{
self::bootKernel();
$em = self::getContainer()->get('doctrine')->getManager();
$em = $this->getManager();
$messageAttachmentRepo = self::getContainer()->get(MessageAttachmentRepository::class);
$messageTagRepo = self::getContainer()->get(MessageTagRepository::class);
@ -273,7 +273,7 @@ class MessageRepositoryTest extends AbstractApiTest
{
self::bootKernel();
$em = self::getContainer()->get('doctrine')->getManager();
$em = $this->getManager();
$messageRepo = self::getContainer()->get(MessageRepository::class);
$userRepo = self::getContainer()->get(UserRepository::class);

@ -221,7 +221,7 @@ class SessionRepositoryTest extends AbstractApiTest
public function testGetSessionRelUser(): void
{
$em = self::getContainer()->get('doctrine')->getManager();
$em = $this->getManager();
$sessionRepo = self::getContainer()->get(SessionRepository::class);
$courseRepo = self::getContainer()->get(CourseRepository::class);
$userRepo = self::getContainer()->get(UserRepository::class);

@ -151,7 +151,7 @@ class UserRepositoryTest extends AbstractApiTest
public function testAddFriendToUser(): void
{
self::bootKernel();
$em = self::getContainer()->get('doctrine')->getManager();
$em = $this->getManager();
$user = $this->createUser('user', 'user');
$friend = $this->createUser('friend', 'friend');

@ -19,7 +19,7 @@ class SessionRepositoryTest extends AbstractApiTest
{
self::bootKernel();
$em = self::getContainer()->get('doctrine')->getManager();
$em = $this->getManager();
$repo = self::getContainer()->get(SessionRepository::class);
$url = $this->getAccessUrl();

@ -61,7 +61,7 @@ class SkillRepositoryTest extends AbstractApiTest
{
self::bootKernel();
$em = self::getContainer()->get('doctrine')->getManager();
$em = $this->getManager();
$skillRepo = self::getContainer()->get(SkillRepository::class);
$assetRepo = self::getContainer()->get(AssetRepository::class);
@ -102,7 +102,7 @@ class SkillRepositoryTest extends AbstractApiTest
{
self::bootKernel();
$em = self::getContainer()->get('doctrine')->getManager();
$em = $this->getManager();
$skillRepo = self::getContainer()->get(SkillRepository::class);
$assetRepo = self::getContainer()->get(AssetRepository::class);

@ -6,16 +6,8 @@ declare(strict_types=1);
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;

@ -7,13 +7,7 @@ declare(strict_types=1);
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;

@ -6,14 +6,8 @@ declare(strict_types=1);
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;

@ -7,11 +7,7 @@ declare(strict_types=1);
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;

@ -6,12 +6,8 @@ declare(strict_types=1);
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;

@ -6,14 +6,8 @@ declare(strict_types=1);
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;

@ -6,9 +6,7 @@ declare(strict_types=1);
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;

@ -6,13 +6,7 @@ declare(strict_types=1);
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;

@ -19,7 +19,7 @@ class SettingsCourseManagerTest extends AbstractApiTest
{
self::bootKernel();
$em = self::getContainer()->get('doctrine')->getManager();
$em = $this->getManager();
$settingsManager = self::getContainer()->get(SettingsCourseManager::class);
$this->expectException(InvalidArgumentException::class);

Loading…
Cancel
Save