[TESTS] Fix unkept unit tests

This commit is contained in:
Hugo Sales 2021-03-31 09:54:50 +00:00
parent 2d70f484f2
commit 1028f05cd8
Signed by untrusted user: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
4 changed files with 13 additions and 12 deletions

View File

@ -17,7 +17,7 @@
// along with GNU social. If not, see <http://www.gnu.org/licenses/>. // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}} // }}}
namespace App\EventListener; namespace App\Core\DB;
use DateTime; use DateTime;
use Doctrine\ORM\Event\PreUpdateEventArgs; use Doctrine\ORM\Event\PreUpdateEventArgs;

View File

@ -26,12 +26,13 @@ use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Event\PreUpdateEventArgs; use Doctrine\ORM\Event\PreUpdateEventArgs;
use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\UnitOfWork; use Doctrine\ORM\UnitOfWork;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
class UpdateListenerTest extends WebTestCase class UpdateListenerTest extends KernelTestCase
{ {
public function testPreUpdate() public function testPreUpdate()
{ {
static::bootKernel();
$actor = new GSActor(); $actor = new GSActor();
$actor->setModified(new DateTime('1999-09-23')); $actor->setModified(new DateTime('1999-09-23'));
static::assertSame($actor->getModified(), new DateTime('1999-09-23')); static::assertSame($actor->getModified(), new DateTime('1999-09-23'));
@ -39,13 +40,13 @@ class UpdateListenerTest extends WebTestCase
$em = $this->createMock(EntityManager::class); $em = $this->createMock(EntityManager::class);
$uow = $this->createMock(UnitOfWork::class); $uow = $this->createMock(UnitOfWork::class);
$em->expects(static::once()) $em->expects(static::once())
->method('getUnitOfWork') ->method('getUnitOfWork')
->willReturn($uow); ->willReturn($uow);
$md = $this->createMock(ClassMetadata::class); $md = $this->createMock(ClassMetadata::class);
$em->expects(static::once()) $em->expects(static::once())
->method('getClassMetadata') ->method('getClassMetadata')
->willReturn($md); ->willReturn($md);
$change_set = []; $change_set = [];
$args = new PreUpdateEventArgs($actor, $em, $change_set); $args = new PreUpdateEventArgs($actor, $em, $change_set);

View File

@ -19,15 +19,13 @@
namespace App\Tests\Core\I18n; namespace App\Tests\Core\I18n;
require_once __DIR__ . '/../../../config/bootstrap.php';
use function App\Core\I18n\_m; use function App\Core\I18n\_m;
use App\Core\I18n\I18n; use App\Core\I18n\I18n;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
// use Jchook\AssertThrows\AssertThrows; // use Jchook\AssertThrows\AssertThrows;
class I18nTest extends WebTestCase class I18nTest extends KernelTestCase
{ {
// use AssertThrows; // use AssertThrows;

View File

@ -1,6 +1,7 @@
<?php <?php
// {{{ License // {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social // This file is part of GNU social - https://www.gnu.org/software/social
// //
// GNU social is free software: you can redistribute it and/or modify // GNU social is free software: you can redistribute it and/or modify
@ -15,6 +16,7 @@
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>. // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}} License // }}} License
/** /**
@ -63,7 +65,7 @@ class ExtensionTest extends KernelTestCase
$icon_template_render = $twig->render('@public_path/assets/icons/' . $icon_file_name, ['iconClass' => 'icon icon-' . $icon_name]); $icon_template_render = $twig->render('@public_path/assets/icons/' . $icon_file_name, ['iconClass' => 'icon icon-' . $icon_name]);
$icons_extension = new Extension(); $icons_extension = new Runtime();
$icon_extension_render = $icons_extension->embedSvgIcon($twig, $icon_name, 'icon icon-' . $icon_name); $icon_extension_render = $icons_extension->embedSvgIcon($twig, $icon_name, 'icon icon-' . $icon_name);
static::assertSame($icon_template_render, $icon_extension_render); static::assertSame($icon_template_render, $icon_extension_render);