diff --git a/.env.test b/.env.test index 107aef6641..5a7c1b29ac 100644 --- a/.env.test +++ b/.env.test @@ -5,14 +5,14 @@ SYMFONY_DEPRECATIONS_HELPER=999999 PANTHER_APP_ENV=panther PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots -DATABASE_HOST='127.0.0.1' +DATABASE_HOST='database' DATABASE_PORT='3306' -DATABASE_NAME='chamilo_test' +DATABASE_NAME='chamilo2' DATABASE_USER='root' -DATABASE_PASSWORD='root' +DATABASE_PASSWORD='afqc' APP_INSTALLED='1' APP_ENV='test' APP_DEBUG='1' APP_LOCALE='en_US' -APP_MULTIPLE_ACCESS_URL='' \ No newline at end of file +APP_MULTIPLE_ACCESS_URL='' diff --git a/src/CoreBundle/Migrations/AbstractMigrationChamilo.php b/src/CoreBundle/Migrations/AbstractMigrationChamilo.php index e507ed4203..8e2e098b0a 100644 --- a/src/CoreBundle/Migrations/AbstractMigrationChamilo.php +++ b/src/CoreBundle/Migrations/AbstractMigrationChamilo.php @@ -8,6 +8,7 @@ namespace Chamilo\CoreBundle\Migrations; use Chamilo\CoreBundle\Entity\AbstractResource; use Chamilo\CoreBundle\Entity\AccessUrl; +use Chamilo\CoreBundle\Entity\Admin; use Chamilo\CoreBundle\Entity\ResourceInterface; use Chamilo\CoreBundle\Entity\ResourceLink; use Chamilo\CoreBundle\Entity\SettingsCurrent; @@ -66,17 +67,12 @@ abstract class AbstractMigrationChamilo extends AbstractMigration implements Con public function getAdmin(): User { - $container = $this->getContainer(); - $em = $this->getEntityManager(); - $connection = $em->getConnection(); - $userRepo = $container->get(UserRepository::class); - - $sql = 'SELECT user_id FROM admin ORDER BY id LIMIT 1'; - $result = $connection->executeQuery($sql); - $adminRow = $result->fetchAssociative(); - $adminId = $adminRow['user_id']; + $admin = $this->getEntityManager() + ->getRepository(Admin::class) + ->findOneBy([], ['id' => 'ASC']) + ; - return $userRepo->find($adminId); + return $admin->getUser(); } /**