Format commands' tests
To simplify and organise the code (also replacing `$this->assert*` with `self::assert*`).
This commit is contained in:
parent
8a893068ce
commit
43a88d539d
@ -30,27 +30,24 @@ class ClearCacheCollectionRegionCommandTest extends OrmFunctionalTestCase
|
||||
$this->enableSecondLevelCache();
|
||||
parent::setUp();
|
||||
|
||||
$this->command = new CollectionRegionCommand();
|
||||
|
||||
$this->application = new Application();
|
||||
$this->command = new CollectionRegionCommand();
|
||||
|
||||
$this->application->setHelperSet(new HelperSet(
|
||||
[
|
||||
'em' => new EntityManagerHelper($this->_em)
|
||||
]
|
||||
));
|
||||
|
||||
$this->application->setHelperSet(new HelperSet(['em' => new EntityManagerHelper($this->_em)]));
|
||||
$this->application->add($this->command);
|
||||
}
|
||||
|
||||
public function testClearAllRegion()
|
||||
{
|
||||
$command = $this->application->find('orm:clear-cache:region:collection');
|
||||
$tester = new CommandTester($command);
|
||||
$command = $this->application->find('orm:clear-cache:region:collection');
|
||||
$tester = new CommandTester($command);
|
||||
|
||||
$tester->execute(
|
||||
[
|
||||
'command' => $command->getName(),
|
||||
'--all' => true,
|
||||
], ['decorated' => false]
|
||||
'command' => $command->getName(),
|
||||
'--all' => true,
|
||||
],
|
||||
['decorated' => false]
|
||||
);
|
||||
|
||||
$this->assertEquals('Clearing all second-level cache collection regions' . PHP_EOL, $tester->getDisplay());
|
||||
@ -58,14 +55,16 @@ class ClearCacheCollectionRegionCommandTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testClearByOwnerEntityClassName()
|
||||
{
|
||||
$command = $this->application->find('orm:clear-cache:region:collection');
|
||||
$tester = new CommandTester($command);
|
||||
$command = $this->application->find('orm:clear-cache:region:collection');
|
||||
$tester = new CommandTester($command);
|
||||
|
||||
$tester->execute(
|
||||
[
|
||||
'command' => $command->getName(),
|
||||
'owner-class' => State::class,
|
||||
'association' => 'cities',
|
||||
], ['decorated' => false]
|
||||
'command' => $command->getName(),
|
||||
'owner-class' => State::class,
|
||||
'association' => 'cities',
|
||||
],
|
||||
['decorated' => false]
|
||||
);
|
||||
|
||||
$this->assertEquals('Clearing second-level cache for collection "Doctrine\Tests\Models\Cache\State#cities"' . PHP_EOL, $tester->getDisplay());
|
||||
@ -73,15 +72,17 @@ class ClearCacheCollectionRegionCommandTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testClearCacheEntryName()
|
||||
{
|
||||
$command = $this->application->find('orm:clear-cache:region:collection');
|
||||
$tester = new CommandTester($command);
|
||||
$command = $this->application->find('orm:clear-cache:region:collection');
|
||||
$tester = new CommandTester($command);
|
||||
|
||||
$tester->execute(
|
||||
[
|
||||
'command' => $command->getName(),
|
||||
'owner-class' => State::class,
|
||||
'association' => 'cities',
|
||||
'owner-id' => 1,
|
||||
], ['decorated' => false]
|
||||
'command' => $command->getName(),
|
||||
'owner-class' => State::class,
|
||||
'association' => 'cities',
|
||||
'owner-id' => 1,
|
||||
],
|
||||
['decorated' => false]
|
||||
);
|
||||
|
||||
$this->assertEquals('Clearing second-level cache entry for collection "Doctrine\Tests\Models\Cache\State#cities" owner entity identified by "1"' . PHP_EOL, $tester->getDisplay());
|
||||
@ -89,15 +90,17 @@ class ClearCacheCollectionRegionCommandTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testFlushRegionName()
|
||||
{
|
||||
$command = $this->application->find('orm:clear-cache:region:collection');
|
||||
$tester = new CommandTester($command);
|
||||
$command = $this->application->find('orm:clear-cache:region:collection');
|
||||
$tester = new CommandTester($command);
|
||||
|
||||
$tester->execute(
|
||||
[
|
||||
'command' => $command->getName(),
|
||||
'owner-class' => State::class,
|
||||
'association' => 'cities',
|
||||
'--flush' => true,
|
||||
], ['decorated' => false]
|
||||
'command' => $command->getName(),
|
||||
'owner-class' => State::class,
|
||||
'association' => 'cities',
|
||||
'--flush' => true,
|
||||
],
|
||||
['decorated' => false]
|
||||
);
|
||||
|
||||
$this->assertEquals('Flushing cache provider configured for "Doctrine\Tests\Models\Cache\State#cities"' . PHP_EOL, $tester->getDisplay());
|
||||
|
@ -30,27 +30,24 @@ class ClearCacheEntityRegionCommandTest extends OrmFunctionalTestCase
|
||||
$this->enableSecondLevelCache();
|
||||
parent::setUp();
|
||||
|
||||
$this->command = new EntityRegionCommand();
|
||||
|
||||
$this->application = new Application();
|
||||
$this->command = new EntityRegionCommand();
|
||||
|
||||
$this->application->setHelperSet(new HelperSet(
|
||||
[
|
||||
'em' => new EntityManagerHelper($this->_em)
|
||||
]
|
||||
));
|
||||
|
||||
$this->application->setHelperSet(new HelperSet(['em' => new EntityManagerHelper($this->_em)]));
|
||||
$this->application->add($this->command);
|
||||
}
|
||||
|
||||
public function testClearAllRegion()
|
||||
{
|
||||
$command = $this->application->find('orm:clear-cache:region:entity');
|
||||
$tester = new CommandTester($command);
|
||||
$command = $this->application->find('orm:clear-cache:region:entity');
|
||||
$tester = new CommandTester($command);
|
||||
|
||||
$tester->execute(
|
||||
[
|
||||
'command' => $command->getName(),
|
||||
'--all' => true,
|
||||
], ['decorated' => false]
|
||||
'command' => $command->getName(),
|
||||
'--all' => true,
|
||||
],
|
||||
['decorated' => false]
|
||||
);
|
||||
|
||||
$this->assertEquals('Clearing all second-level cache entity regions' . PHP_EOL, $tester->getDisplay());
|
||||
@ -58,13 +55,15 @@ class ClearCacheEntityRegionCommandTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testClearByEntityClassName()
|
||||
{
|
||||
$command = $this->application->find('orm:clear-cache:region:entity');
|
||||
$tester = new CommandTester($command);
|
||||
$command = $this->application->find('orm:clear-cache:region:entity');
|
||||
$tester = new CommandTester($command);
|
||||
|
||||
$tester->execute(
|
||||
[
|
||||
'command' => $command->getName(),
|
||||
'entity-class' => Country::class,
|
||||
], ['decorated' => false]
|
||||
'command' => $command->getName(),
|
||||
'entity-class' => Country::class,
|
||||
],
|
||||
['decorated' => false]
|
||||
);
|
||||
|
||||
$this->assertEquals('Clearing second-level cache for entity "Doctrine\Tests\Models\Cache\Country"' . PHP_EOL, $tester->getDisplay());
|
||||
@ -72,14 +71,16 @@ class ClearCacheEntityRegionCommandTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testClearCacheEntryName()
|
||||
{
|
||||
$command = $this->application->find('orm:clear-cache:region:entity');
|
||||
$tester = new CommandTester($command);
|
||||
$command = $this->application->find('orm:clear-cache:region:entity');
|
||||
$tester = new CommandTester($command);
|
||||
|
||||
$tester->execute(
|
||||
[
|
||||
'command' => $command->getName(),
|
||||
'entity-class' => Country::class,
|
||||
'entity-id' => 1,
|
||||
], ['decorated' => false]
|
||||
'command' => $command->getName(),
|
||||
'entity-class' => Country::class,
|
||||
'entity-id' => 1,
|
||||
],
|
||||
['decorated' => false]
|
||||
);
|
||||
|
||||
$this->assertEquals('Clearing second-level cache entry for entity "Doctrine\Tests\Models\Cache\Country" identified by "1"' . PHP_EOL, $tester->getDisplay());
|
||||
@ -87,14 +88,16 @@ class ClearCacheEntityRegionCommandTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testFlushRegionName()
|
||||
{
|
||||
$command = $this->application->find('orm:clear-cache:region:entity');
|
||||
$tester = new CommandTester($command);
|
||||
$command = $this->application->find('orm:clear-cache:region:entity');
|
||||
$tester = new CommandTester($command);
|
||||
|
||||
$tester->execute(
|
||||
[
|
||||
'command' => $command->getName(),
|
||||
'entity-class' => Country::class,
|
||||
'--flush' => true,
|
||||
], ['decorated' => false]
|
||||
'command' => $command->getName(),
|
||||
'entity-class' => Country::class,
|
||||
'--flush' => true,
|
||||
],
|
||||
['decorated' => false]
|
||||
);
|
||||
|
||||
$this->assertEquals('Flushing cache provider configured for entity named "Doctrine\Tests\Models\Cache\Country"' . PHP_EOL, $tester->getDisplay());
|
||||
|
@ -4,10 +4,10 @@ namespace Doctrine\Tests\ORM\Tools\Console\Command;
|
||||
|
||||
use Doctrine\ORM\Tools\Console\Command\ClearCache\QueryRegionCommand;
|
||||
use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use Symfony\Component\Console\Helper\HelperSet;
|
||||
use Symfony\Component\Console\Application;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\Console\Helper\HelperSet;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
|
||||
/**
|
||||
* @group DDC-2183
|
||||
@ -29,27 +29,24 @@ class ClearCacheQueryRegionCommandTest extends OrmFunctionalTestCase
|
||||
$this->enableSecondLevelCache();
|
||||
parent::setUp();
|
||||
|
||||
$this->command = new QueryRegionCommand();
|
||||
|
||||
$this->application = new Application();
|
||||
$this->command = new QueryRegionCommand();
|
||||
|
||||
$this->application->setHelperSet(new HelperSet(
|
||||
[
|
||||
'em' => new EntityManagerHelper($this->_em)
|
||||
]
|
||||
));
|
||||
|
||||
$this->application->setHelperSet(new HelperSet(['em' => new EntityManagerHelper($this->_em)]));
|
||||
$this->application->add($this->command);
|
||||
}
|
||||
|
||||
public function testClearAllRegion()
|
||||
{
|
||||
$command = $this->application->find('orm:clear-cache:region:query');
|
||||
$tester = new CommandTester($command);
|
||||
$command = $this->application->find('orm:clear-cache:region:query');
|
||||
$tester = new CommandTester($command);
|
||||
|
||||
$tester->execute(
|
||||
[
|
||||
'command' => $command->getName(),
|
||||
'--all' => true,
|
||||
], ['decorated' => false]
|
||||
'command' => $command->getName(),
|
||||
'--all' => true,
|
||||
],
|
||||
['decorated' => false]
|
||||
);
|
||||
|
||||
$this->assertEquals('Clearing all second-level cache query regions' . PHP_EOL, $tester->getDisplay());
|
||||
@ -57,13 +54,15 @@ class ClearCacheQueryRegionCommandTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testClearDefaultRegionName()
|
||||
{
|
||||
$command = $this->application->find('orm:clear-cache:region:query');
|
||||
$tester = new CommandTester($command);
|
||||
$command = $this->application->find('orm:clear-cache:region:query');
|
||||
$tester = new CommandTester($command);
|
||||
|
||||
$tester->execute(
|
||||
[
|
||||
'command' => $command->getName(),
|
||||
'region-name' => null,
|
||||
], ['decorated' => false]
|
||||
'command' => $command->getName(),
|
||||
'region-name' => null,
|
||||
],
|
||||
['decorated' => false]
|
||||
);
|
||||
|
||||
$this->assertEquals('Clearing second-level cache query region named "query_cache_region"' . PHP_EOL, $tester->getDisplay());
|
||||
@ -71,13 +70,15 @@ class ClearCacheQueryRegionCommandTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testClearByRegionName()
|
||||
{
|
||||
$command = $this->application->find('orm:clear-cache:region:query');
|
||||
$tester = new CommandTester($command);
|
||||
$command = $this->application->find('orm:clear-cache:region:query');
|
||||
$tester = new CommandTester($command);
|
||||
|
||||
$tester->execute(
|
||||
[
|
||||
'command' => $command->getName(),
|
||||
'region-name' => 'my_region',
|
||||
], ['decorated' => false]
|
||||
'command' => $command->getName(),
|
||||
'region-name' => 'my_region',
|
||||
],
|
||||
['decorated' => false]
|
||||
);
|
||||
|
||||
$this->assertEquals('Clearing second-level cache query region named "my_region"' . PHP_EOL, $tester->getDisplay());
|
||||
@ -85,14 +86,16 @@ class ClearCacheQueryRegionCommandTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testFlushRegionName()
|
||||
{
|
||||
$command = $this->application->find('orm:clear-cache:region:query');
|
||||
$tester = new CommandTester($command);
|
||||
$command = $this->application->find('orm:clear-cache:region:query');
|
||||
$tester = new CommandTester($command);
|
||||
|
||||
$tester->execute(
|
||||
[
|
||||
'command' => $command->getName(),
|
||||
'region-name' => 'my_region',
|
||||
'--flush' => true,
|
||||
], ['decorated' => false]
|
||||
'command' => $command->getName(),
|
||||
'region-name' => 'my_region',
|
||||
'--flush' => true,
|
||||
],
|
||||
['decorated' => false]
|
||||
);
|
||||
|
||||
$this->assertEquals('Flushing cache provider configured for second-level cache query region named "my_region"' . PHP_EOL, $tester->getDisplay());
|
||||
|
@ -2,18 +2,18 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Tools\Console\Command;
|
||||
|
||||
use Doctrine\Common\Persistence\Mapping\ClassMetadataFactory;
|
||||
use Doctrine\ORM\Configuration;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand;
|
||||
use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper;
|
||||
use Doctrine\Tests\Models\DDC3231\DDC3231EntityRepository;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use Symfony\Component\Console\Helper\HelperSet;
|
||||
use Symfony\Component\Console\Application;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\Console\Helper\HelperSet;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
|
||||
/**
|
||||
* GenerateRepositoriesCommandTest
|
||||
*/
|
||||
class GenerateRepositoriesCommandTest extends OrmFunctionalTestCase
|
||||
{
|
||||
/**
|
||||
@ -34,25 +34,12 @@ class GenerateRepositoriesCommandTest extends OrmFunctionalTestCase
|
||||
|
||||
\mkdir($this->path);
|
||||
|
||||
|
||||
$metadataDriver = $this->_em->getConfiguration()->getMetadataDriverImpl();
|
||||
|
||||
$metadataDriver->addPaths(
|
||||
[
|
||||
__DIR__ . '/../../../../Models/DDC3231/'
|
||||
]
|
||||
);
|
||||
$metadataDriver->addPaths([__DIR__ . '/../../../../Models/DDC3231/']);
|
||||
|
||||
$this->application = new Application();
|
||||
|
||||
$this->application->setHelperSet(new HelperSet(
|
||||
[
|
||||
'em' => new EntityManagerHelper($this->_em)
|
||||
]
|
||||
));
|
||||
|
||||
$this->application->setHelperSet(new HelperSet(['em' => new EntityManagerHelper($this->_em)]));
|
||||
$this->application->add(new GenerateRepositoriesCommand());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -88,20 +75,20 @@ class GenerateRepositoriesCommandTest extends OrmFunctionalTestCase
|
||||
$cname = 'Doctrine\Tests\Models\DDC3231\DDC3231User1Repository';
|
||||
$fname = str_replace('\\', DIRECTORY_SEPARATOR, $cname) . '.php';
|
||||
|
||||
$this->assertFileExists($this->path . DIRECTORY_SEPARATOR . $fname);
|
||||
$this->assertFileExists($this->path . DIRECTORY_SEPARATOR . 'DDC3231User1NoNamespaceRepository.php');
|
||||
self::assertFileExists($this->path . DIRECTORY_SEPARATOR . $fname);
|
||||
self::assertFileExists($this->path . DIRECTORY_SEPARATOR . 'DDC3231User1NoNamespaceRepository.php');
|
||||
|
||||
require $this->path . DIRECTORY_SEPARATOR . $fname;
|
||||
require $this->path . DIRECTORY_SEPARATOR . 'DDC3231User1NoNamespaceRepository.php';
|
||||
|
||||
$this->assertTrue(class_exists($cname));
|
||||
$this->assertTrue(class_exists('DDC3231User1NoNamespaceRepository'));
|
||||
self::assertTrue(class_exists($cname));
|
||||
self::assertTrue(class_exists('DDC3231User1NoNamespaceRepository'));
|
||||
|
||||
$repo1 = new \ReflectionClass($cname);
|
||||
$repo2 = new \ReflectionClass('DDC3231User1NoNamespaceRepository');
|
||||
|
||||
$this->assertSame(EntityRepository::class, $repo1->getParentClass()->getName());
|
||||
$this->assertSame(EntityRepository::class, $repo2->getParentClass()->getName());
|
||||
self::assertSame(EntityRepository::class, $repo1->getParentClass()->getName());
|
||||
self::assertSame(EntityRepository::class, $repo2->getParentClass()->getName());
|
||||
}
|
||||
|
||||
public function testGenerateRepositoriesCustomDefaultRepository()
|
||||
@ -111,20 +98,20 @@ class GenerateRepositoriesCommandTest extends OrmFunctionalTestCase
|
||||
$cname = 'Doctrine\Tests\Models\DDC3231\DDC3231User2Repository';
|
||||
$fname = str_replace('\\', DIRECTORY_SEPARATOR, $cname) . '.php';
|
||||
|
||||
$this->assertFileExists($this->path . DIRECTORY_SEPARATOR . $fname);
|
||||
$this->assertFileExists($this->path . DIRECTORY_SEPARATOR . 'DDC3231User2NoNamespaceRepository.php');
|
||||
self::assertFileExists($this->path . DIRECTORY_SEPARATOR . $fname);
|
||||
self::assertFileExists($this->path . DIRECTORY_SEPARATOR . 'DDC3231User2NoNamespaceRepository.php');
|
||||
|
||||
require $this->path . DIRECTORY_SEPARATOR . $fname;
|
||||
require $this->path . DIRECTORY_SEPARATOR . 'DDC3231User2NoNamespaceRepository.php';
|
||||
|
||||
$this->assertTrue(class_exists($cname));
|
||||
$this->assertTrue(class_exists('DDC3231User2NoNamespaceRepository'));
|
||||
self::assertTrue(class_exists($cname));
|
||||
self::assertTrue(class_exists('DDC3231User2NoNamespaceRepository'));
|
||||
|
||||
$repo1 = new \ReflectionClass($cname);
|
||||
$repo2 = new \ReflectionClass('DDC3231User2NoNamespaceRepository');
|
||||
|
||||
$this->assertSame(DDC3231EntityRepository::class, $repo1->getParentClass()->getName());
|
||||
$this->assertSame(DDC3231EntityRepository::class, $repo2->getParentClass()->getName());
|
||||
self::assertSame(DDC3231EntityRepository::class, $repo1->getParentClass()->getName());
|
||||
self::assertSame(DDC3231EntityRepository::class, $repo2->getParentClass()->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -137,13 +124,14 @@ class GenerateRepositoriesCommandTest extends OrmFunctionalTestCase
|
||||
$this->_em->getConfiguration()->setDefaultRepositoryClassName($defaultRepository);
|
||||
}
|
||||
|
||||
$command = $this->application->find('orm:generate-repositories');
|
||||
$tester = new CommandTester($command);
|
||||
$command = $this->application->find('orm:generate-repositories');
|
||||
$tester = new CommandTester($command);
|
||||
|
||||
$tester->execute(
|
||||
[
|
||||
'command' => $command->getName(),
|
||||
'dest-path' => $this->path,
|
||||
'--filter' => $filter,
|
||||
'command' => $command->getName(),
|
||||
'dest-path' => $this->path,
|
||||
'--filter' => $filter,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -2,6 +2,10 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Tools\Console\Command;
|
||||
|
||||
use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver;
|
||||
use Doctrine\ORM\Configuration;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Mapping\MappingException;
|
||||
use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper;
|
||||
use Doctrine\Tests\Models\Cache\AttractionInfo;
|
||||
use Doctrine\Tests\Models\Cache\City;
|
||||
@ -33,23 +37,19 @@ class InfoCommandTest extends OrmFunctionalTestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->application = new Application();
|
||||
$command = new InfoCommand();
|
||||
|
||||
$this->application->setHelperSet(
|
||||
new HelperSet(['em' => new EntityManagerHelper($this->_em)])
|
||||
);
|
||||
$this->application->setHelperSet(new HelperSet(['em' => new EntityManagerHelper($this->_em)]));
|
||||
$this->application->add(new InfoCommand());
|
||||
|
||||
$this->application->add($command);
|
||||
|
||||
$this->command = $this->application->find('orm:info');
|
||||
$this->tester = new CommandTester($command);
|
||||
$this->command = $this->application->find('orm:info');
|
||||
$this->tester = new CommandTester($this->command);
|
||||
}
|
||||
|
||||
public function testListAllClasses()
|
||||
{
|
||||
$this->tester->execute(['command' => $this->command->getName()]);
|
||||
|
||||
$this->assertContains(AttractionInfo::class, $this->tester->getDisplay());
|
||||
$this->assertContains(City::class, $this->tester->getDisplay());
|
||||
self::assertContains(AttractionInfo::class, $this->tester->getDisplay());
|
||||
self::assertContains(City::class, $this->tester->getDisplay());
|
||||
}
|
||||
}
|
||||
|
@ -37,32 +37,26 @@ class MappingDescribeCommandTest extends OrmFunctionalTestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->application = new Application();
|
||||
$command = new MappingDescribeCommand();
|
||||
|
||||
$this->application->setHelperSet(new HelperSet(
|
||||
[
|
||||
'em' => new EntityManagerHelper($this->_em)
|
||||
]
|
||||
));
|
||||
|
||||
$this->application->add($command);
|
||||
$this->application->setHelperSet(new HelperSet(['em' => new EntityManagerHelper($this->_em)]));
|
||||
$this->application->add(new MappingDescribeCommand());
|
||||
|
||||
$this->command = $this->application->find('orm:mapping:describe');
|
||||
$this->tester = new CommandTester($command);
|
||||
$this->tester = new CommandTester($this->command);
|
||||
}
|
||||
|
||||
public function testShowSpecificFuzzySingle()
|
||||
{
|
||||
$this->tester->execute(
|
||||
[
|
||||
'command' => $this->command->getName(),
|
||||
'entityName' => 'AttractionInfo',
|
||||
'command' => $this->command->getName(),
|
||||
'entityName' => 'AttractionInfo',
|
||||
]
|
||||
);
|
||||
|
||||
$display = $this->tester->getDisplay();
|
||||
$this->assertContains(AttractionInfo::class, $display);
|
||||
$this->assertContains('Root entity name', $display);
|
||||
|
||||
self::assertContains(AttractionInfo::class, $display);
|
||||
self::assertContains('Root entity name', $display);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -73,8 +67,8 @@ class MappingDescribeCommandTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->tester->execute(
|
||||
[
|
||||
'command' => $this->command->getName(),
|
||||
'entityName' => 'Attraction',
|
||||
'command' => $this->command->getName(),
|
||||
'entityName' => 'Attraction',
|
||||
]
|
||||
);
|
||||
}
|
||||
@ -87,8 +81,8 @@ class MappingDescribeCommandTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->tester->execute(
|
||||
[
|
||||
'command' => $this->command->getName(),
|
||||
'entityName' => 'AttractionFooBar'
|
||||
'command' => $this->command->getName(),
|
||||
'entityName' => 'AttractionFooBar',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -38,15 +38,10 @@ class RunDqlCommandTest extends OrmFunctionalTestCase
|
||||
|
||||
parent::setUp();
|
||||
|
||||
$this->command = new RunDqlCommand();
|
||||
|
||||
$this->application = new Application();
|
||||
$this->command = new RunDqlCommand();
|
||||
|
||||
$this->application->setHelperSet(new HelperSet(
|
||||
[
|
||||
'em' => new EntityManagerHelper($this->_em)
|
||||
]
|
||||
));
|
||||
|
||||
$this->application->setHelperSet(new HelperSet(['em' => new EntityManagerHelper($this->_em)]));
|
||||
$this->application->add($this->command);
|
||||
|
||||
$this->tester = new CommandTester($this->command);
|
||||
@ -54,7 +49,7 @@ class RunDqlCommandTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testCommandName()
|
||||
{
|
||||
$this->assertSame($this->command, $this->application->get('orm:run-dql'));
|
||||
self::assertSame($this->command, $this->application->get('orm:run-dql'));
|
||||
}
|
||||
|
||||
public function testWillRunQuery()
|
||||
@ -62,17 +57,17 @@ class RunDqlCommandTest extends OrmFunctionalTestCase
|
||||
$this->_em->persist(new DateTimeModel());
|
||||
$this->_em->flush();
|
||||
|
||||
$this->assertSame(
|
||||
self::assertSame(
|
||||
0,
|
||||
$this->tester->execute(
|
||||
[
|
||||
'command' => $this->command->getName(),
|
||||
'dql' => 'SELECT e FROM ' . DateTimeModel::class . ' e',
|
||||
'command' => $this->command->getName(),
|
||||
'dql' => 'SELECT e FROM ' . DateTimeModel::class . ' e',
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertContains(DateTimeModel::class, $this->tester->getDisplay());
|
||||
self::assertContains(DateTimeModel::class, $this->tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testWillShowQuery()
|
||||
@ -80,17 +75,17 @@ class RunDqlCommandTest extends OrmFunctionalTestCase
|
||||
$this->_em->persist(new DateTimeModel());
|
||||
$this->_em->flush();
|
||||
|
||||
$this->assertSame(
|
||||
self::assertSame(
|
||||
0,
|
||||
$this->tester->execute(
|
||||
[
|
||||
'command' => $this->command->getName(),
|
||||
'dql' => 'SELECT e FROM ' . DateTimeModel::class . ' e',
|
||||
'--show-sql' => 'true'
|
||||
'command' => $this->command->getName(),
|
||||
'dql' => 'SELECT e FROM ' . DateTimeModel::class . ' e',
|
||||
'--show-sql' => 'true',
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertStringMatchesFormat('%Astring%sSELECT %a', $this->tester->getDisplay());
|
||||
self::assertStringMatchesFormat('%Astring%sSELECT %a', $this->tester->getDisplay());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user