[TESTS] Expand test coverage for App\Util\Forms\ArrayTransformer, App\Util\Notification and App\Twig\Runtime

This commit is contained in:
2021-05-05 13:37:10 +00:00
parent 33cdea87ee
commit b79c0595d5
5 changed files with 66 additions and 4 deletions

View File

@@ -33,10 +33,13 @@
namespace App\Tests\Twig;
use App\Core\DB\DB;
use App\Core\Event;
use App\Twig\Extension;
use App\Twig\Runtime;
use DirectoryIterator;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
class ExtensionTest extends KernelTestCase
@@ -89,4 +92,19 @@ class ExtensionTest extends KernelTestCase
static::assertSame('active', $runtime->isCurrentRouteActive('current_route'));
static::assertSame('', $runtime->isCurrentRouteActive('some_route', 'some_other_route'));
}
public function testGetNoteActions()
{
static::bootKernel();
DB::setManager(self::$kernel->getContainer()->get('doctrine.orm.entity_manager'));
DB::initTableMap();
$container = self::$kernel->getContainer()->get('test.service_container');
$edi = $container->get(EventDispatcherInterface::class);
Event::setDispatcher($edi);
$req = $this->createMock(Request::class);
$runtime = new Runtime;
$runtime->setRequest($req);
static::assertSame([], $runtime->getNoteActions(DB::dql('select n from note n where n.content = \'some content\'')[0]));
}
}