[TESTS] Add missing tests for Common

This commit is contained in:
Hugo Sales 2021-07-20 14:08:43 +00:00
parent 9ce30751af
commit 747b464c7d
No known key found for this signature in database
GPG Key ID: 7D0C7EAFC9D835A0

View File

@ -31,6 +31,8 @@ use Doctrine\ORM\Mapping\ClassMetadataFactory;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Jchook\AssertThrows\AssertThrows;
use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Security as SSecurity;
class CommonTest extends GNUsocialTestCase
@ -63,6 +65,16 @@ class CommonTest extends GNUsocialTestCase
}
}
public function testSetRequestAndRoute()
{
$req = $this->createMock(Request::class);
$req->attributes = $this->createMock(ParameterBag::class);
$req->attributes->method('get')->willReturn('test_route');
Common::setRequest($req);
static::assertSame('test_route', Common::route());
static::assertTrue(Common::isRoute('test_route'));
}
/**
* Test Common::user, Common::actor and such. Requires a lot of setup
*/