forked from wallabag/wallabag
Import used classes
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
|
||||
namespace Tests\Wallabag\AnnotationBundle;
|
||||
|
||||
use FOS\UserBundle\Model\UserInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Client;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\BrowserKit\Cookie;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
@ -10,12 +12,12 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt
|
||||
abstract class WallabagAnnotationTestCase extends WebTestCase
|
||||
{
|
||||
/**
|
||||
* @var \Symfony\Bundle\FrameworkBundle\Client
|
||||
* @var Client
|
||||
*/
|
||||
protected $client = null;
|
||||
|
||||
/**
|
||||
* @var \FOS\UserBundle\Model\UserInterface
|
||||
* @var UserInterface
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
@ -37,7 +39,7 @@ abstract class WallabagAnnotationTestCase extends WebTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Symfony\Bundle\FrameworkBundle\Client
|
||||
* @return Client
|
||||
*/
|
||||
protected function createAuthorizedClient()
|
||||
{
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
namespace Tests\Wallabag\ApiBundle\Controller;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
use Tests\Wallabag\ApiBundle\WallabagApiTestCase;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\CoreBundle\Entity\Tag;
|
||||
@ -556,7 +557,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
||||
|
||||
public function testPostEntryWhenFetchContentFails()
|
||||
{
|
||||
/** @var \Symfony\Component\DependencyInjection\Container $container */
|
||||
/** @var Container $container */
|
||||
$container = $this->client->getContainer();
|
||||
$contentProxy = $this->getMockBuilder(ContentProxy::class)
|
||||
->disableOriginalConstructor()
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
namespace Tests\Wallabag\ApiBundle;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use FOS\UserBundle\Model\UserInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Client;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\BrowserKit\Cookie;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
@ -12,12 +14,12 @@ use Wallabag\UserBundle\Entity\User;
|
||||
abstract class WallabagApiTestCase extends WebTestCase
|
||||
{
|
||||
/**
|
||||
* @var \Symfony\Bundle\FrameworkBundle\Client
|
||||
* @var Client
|
||||
*/
|
||||
protected $client = null;
|
||||
|
||||
/**
|
||||
* @var \FOS\UserBundle\Model\UserInterface
|
||||
* @var UserInterface
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
@ -27,7 +29,7 @@ abstract class WallabagApiTestCase extends WebTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Symfony\Bundle\FrameworkBundle\Client
|
||||
* @return Client
|
||||
*/
|
||||
protected function createAuthorizedClient()
|
||||
{
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
namespace Tests\Wallabag\CoreBundle\Command;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
use Wallabag\CoreBundle\Command\ExportCommand;
|
||||
@ -11,7 +12,7 @@ class ExportCommandTest extends WallabagCoreTestCase
|
||||
{
|
||||
public function testExportCommandWithoutUsername()
|
||||
{
|
||||
$this->expectException(\Symfony\Component\Console\Exception\RuntimeException::class);
|
||||
$this->expectException(RuntimeException::class);
|
||||
$this->expectExceptionMessage('Not enough arguments (missing: "username")');
|
||||
|
||||
$application = new Application($this->getClient()->getKernel());
|
||||
|
||||
@ -6,6 +6,7 @@ use DAMA\DoctrineTestBundle\Doctrine\DBAL\StaticDriver;
|
||||
use Doctrine\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand;
|
||||
use Doctrine\Bundle\DoctrineBundle\Command\DropDatabaseDoctrineCommand;
|
||||
use Doctrine\Bundle\MigrationsBundle\Command\MigrationsMigrateDoctrineCommand;
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
|
||||
use Doctrine\DBAL\Platforms\SqlitePlatform;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
@ -35,7 +36,7 @@ class InstallCommandTest extends WallabagCoreTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
/** @var \Doctrine\DBAL\Connection $connection */
|
||||
/** @var Connection $connection */
|
||||
$connection = $this->getClient()->getContainer()->get(ManagerRegistry::class)->getConnection();
|
||||
if ($connection->getDatabasePlatform() instanceof PostgreSqlPlatform) {
|
||||
/*
|
||||
@ -143,7 +144,7 @@ class InstallCommandTest extends WallabagCoreTestCase
|
||||
{
|
||||
// skipped SQLite check when database is removed because while testing for the connection,
|
||||
// the driver will create the file (so the database) before testing if database exist
|
||||
if ($this->getClient()->getContainer()->get(ManagerRegistry::class)->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
|
||||
if ($this->getClient()->getContainer()->get(ManagerRegistry::class)->getConnection()->getDatabasePlatform() instanceof SqlitePlatform) {
|
||||
$this->markTestSkipped('SQLite spotted: can\'t test with database removed.');
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ namespace Tests\Wallabag\CoreBundle\Command;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
use Wallabag\CoreBundle\Command\ShowUserCommand;
|
||||
@ -13,7 +14,7 @@ class ShowUserCommandTest extends WallabagCoreTestCase
|
||||
{
|
||||
public function testRunShowUserCommandWithoutUsername()
|
||||
{
|
||||
$this->expectException(\Symfony\Component\Console\Exception\RuntimeException::class);
|
||||
$this->expectException(RuntimeException::class);
|
||||
$this->expectExceptionMessage('Not enough arguments');
|
||||
|
||||
$application = new Application($this->getClient()->getKernel());
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
namespace Tests\Wallabag\CoreBundle\Command;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
use Wallabag\CoreBundle\Command\TagAllCommand;
|
||||
@ -11,7 +12,7 @@ class TagAllCommandTest extends WallabagCoreTestCase
|
||||
{
|
||||
public function testRunTagAllCommandWithoutUsername()
|
||||
{
|
||||
$this->expectException(\Symfony\Component\Console\Exception\RuntimeException::class);
|
||||
$this->expectException(RuntimeException::class);
|
||||
$this->expectExceptionMessage('Not enough arguments (missing: "username")');
|
||||
|
||||
$application = new Application($this->getClient()->getKernel());
|
||||
|
||||
@ -3,6 +3,9 @@
|
||||
namespace Tests\Wallabag\CoreBundle\Event\Subscriber;
|
||||
|
||||
use Doctrine\Common\EventManager;
|
||||
use Doctrine\DBAL\Platforms\MySqlPlatform;
|
||||
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
|
||||
use Doctrine\DBAL\Platforms\SqlitePlatform;
|
||||
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@ -13,21 +16,21 @@ class TablePrefixSubscriberTest extends TestCase
|
||||
public function dataForPrefix()
|
||||
{
|
||||
return [
|
||||
['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()],
|
||||
['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '`wallabag_user`', new \Doctrine\DBAL\Platforms\MySqlPlatform()],
|
||||
['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new \Doctrine\DBAL\Platforms\SqlitePlatform()],
|
||||
['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new PostgreSqlPlatform()],
|
||||
['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '`wallabag_user`', new MySqlPlatform()],
|
||||
['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new SqlitePlatform()],
|
||||
|
||||
['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()],
|
||||
['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\MySqlPlatform()],
|
||||
['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\SqlitePlatform()],
|
||||
['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new PostgreSqlPlatform()],
|
||||
['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new MySqlPlatform()],
|
||||
['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new SqlitePlatform()],
|
||||
|
||||
['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()],
|
||||
['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '`user`', new \Doctrine\DBAL\Platforms\MySqlPlatform()],
|
||||
['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new \Doctrine\DBAL\Platforms\SqlitePlatform()],
|
||||
['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new PostgreSqlPlatform()],
|
||||
['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '`user`', new MySqlPlatform()],
|
||||
['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new SqlitePlatform()],
|
||||
|
||||
['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()],
|
||||
['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\MySqlPlatform()],
|
||||
['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\SqlitePlatform()],
|
||||
['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new PostgreSqlPlatform()],
|
||||
['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new MySqlPlatform()],
|
||||
['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new SqlitePlatform()],
|
||||
];
|
||||
}
|
||||
|
||||
@ -110,6 +113,6 @@ class TablePrefixSubscriberTest extends TestCase
|
||||
|
||||
$this->assertSame('yo_entry', $metaDataEvent->getClassMetadata()->getTableName());
|
||||
$this->assertSame('yo_entry_tag', $metaDataEvent->getClassMetadata()->associationMappings['tags']['joinTable']['name']);
|
||||
$this->assertSame('yo_entry', $metaDataEvent->getClassMetadata()->getQuotedTableName(new \Doctrine\DBAL\Platforms\MySqlPlatform()));
|
||||
$this->assertSame('yo_entry', $metaDataEvent->getClassMetadata()->getQuotedTableName(new MySqlPlatform()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ namespace Tests\Wallabag\CoreBundle\ParamConverter;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Wallabag\CoreBundle\ParamConverter\UsernameFeedTokenConverter;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
|
||||
@ -138,7 +139,7 @@ class UsernameFeedTokenConverterTest extends TestCase
|
||||
|
||||
public function testApplyUserNotFound()
|
||||
{
|
||||
$this->expectException(\Symfony\Component\HttpKernel\Exception\NotFoundHttpException::class);
|
||||
$this->expectException(NotFoundHttpException::class);
|
||||
$this->expectExceptionMessage('User not found');
|
||||
|
||||
$repo = $this->getMockBuilder('Wallabag\UserBundle\Repository\UserRepository')
|
||||
|
||||
@ -2,7 +2,10 @@
|
||||
|
||||
namespace Tests\Wallabag\ImportBundle\Command;
|
||||
|
||||
use Doctrine\ORM\NoResultException;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
use Wallabag\ImportBundle\Command\ImportCommand;
|
||||
@ -11,7 +14,7 @@ class ImportCommandTest extends WallabagCoreTestCase
|
||||
{
|
||||
public function testRunImportCommandWithoutArguments()
|
||||
{
|
||||
$this->expectException(\Symfony\Component\Console\Exception\RuntimeException::class);
|
||||
$this->expectException(RuntimeException::class);
|
||||
$this->expectExceptionMessage('Not enough arguments');
|
||||
|
||||
$application = new Application($this->getClient()->getKernel());
|
||||
@ -27,7 +30,7 @@ class ImportCommandTest extends WallabagCoreTestCase
|
||||
|
||||
public function testRunImportCommandWithoutFilepath()
|
||||
{
|
||||
$this->expectException(\Symfony\Component\Config\Definition\Exception\Exception::class);
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionMessage('not found');
|
||||
|
||||
$application = new Application($this->getClient()->getKernel());
|
||||
@ -45,7 +48,7 @@ class ImportCommandTest extends WallabagCoreTestCase
|
||||
|
||||
public function testRunImportCommandWithWrongUsername()
|
||||
{
|
||||
$this->expectException(\Doctrine\ORM\NoResultException::class);
|
||||
$this->expectException(NoResultException::class);
|
||||
|
||||
$application = new Application($this->getClient()->getKernel());
|
||||
$application->add(new ImportCommand());
|
||||
|
||||
@ -5,6 +5,8 @@ namespace Tests\Wallabag\ImportBundle\Command;
|
||||
use M6Web\Component\RedisMock\RedisMockFactory;
|
||||
use Predis\Client;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
use Wallabag\ImportBundle\Command\RedisWorkerCommand;
|
||||
@ -13,7 +15,7 @@ class RedisWorkerCommandTest extends WallabagCoreTestCase
|
||||
{
|
||||
public function testRunRedisWorkerCommandWithoutArguments()
|
||||
{
|
||||
$this->expectException(\Symfony\Component\Console\Exception\RuntimeException::class);
|
||||
$this->expectException(RuntimeException::class);
|
||||
$this->expectExceptionMessage('Not enough arguments (missing: "serviceName")');
|
||||
|
||||
$application = new Application($this->getClient()->getKernel());
|
||||
@ -29,7 +31,7 @@ class RedisWorkerCommandTest extends WallabagCoreTestCase
|
||||
|
||||
public function testRunRedisWorkerCommandWithBadService()
|
||||
{
|
||||
$this->expectException(\Symfony\Component\Config\Definition\Exception\Exception::class);
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionMessage('No queue or consumer found for service name');
|
||||
|
||||
$application = new Application($this->getClient()->getKernel());
|
||||
|
||||
Reference in New Issue
Block a user