Skip to content
Permalink
Browse files

fix test names to PSR-4

  • Loading branch information
TomasVotruba committed Dec 9, 2019
1 parent dd19c84 commit 3b17cdf656b5f904c4222c559d78bbd17217881a
@@ -20,15 +20,22 @@
"ext-pdo_mysql": "*",
"ext-pdo_pgsql": "*",
"doctrine/orm": "^2.6",
"phpunit/phpunit": "^8.4",
"phpunit/phpunit": "^8.5",
"jakub-onderka/php-parallel-lint": "^1.0",
"symplify/easy-coding-standard": "^7.1"
"symplify/easy-coding-standard": "^7.1",
"phpstan/phpstan": "^0.12.2"
},
"autoload": {
"psr-4": {
"Knp\\DoctrineBehaviors\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"BehaviorFixtures\\": "tests/Fixtures/BehaviorFixtures",
"Tests\\Knp\\DoctrineBehaviors\\": "tests/Knp/DoctrineBehaviors"
}
},
"suggest": {
"symfony/framework-bundle": "To be able to use it as a bundle"
},
@@ -0,0 +1,6 @@
parameters:
level: 0

ignoreErrors:
# traits
- '#Access to an undefined property BehaviorFixtures\\ORM\\TreeNodeEntity::\$parentNodePath#'
@@ -40,7 +40,7 @@ public function __construct(ClassAnalyzer $classAnalyzer, $isRecursive, callable
$this->loggerCallable = $loggerCallable;
}

public function postPersist(LifecycleEventArgs $eventArgs)
public function postPersist(LifecycleEventArgs $eventArgs): void
{
$em = $eventArgs->getEntityManager();
$entity = $eventArgs->getEntity();
@@ -52,12 +52,12 @@ public function postPersist(LifecycleEventArgs $eventArgs)
$loggerCallable($message);
}

return $this->logChangeSet($eventArgs);
$this->logChangeSet($eventArgs);
}

public function postUpdate(LifecycleEventArgs $eventArgs)
public function postUpdate(LifecycleEventArgs $eventArgs): void
{
return $this->logChangeSet($eventArgs);
$this->logChangeSet($eventArgs);
}

/**
@@ -13,14 +13,12 @@

namespace Knp\DoctrineBehaviors\ORM\Translatable;

use Doctrine\DBAL\Platforms;

use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
use Doctrine\ORM\Events;
use Doctrine\ORM\Id\BigIntegerIdentityGenerator;

use Doctrine\ORM\Id\IdentityGenerator;
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
use Doctrine\ORM\Mapping\ClassMetadata;
@@ -124,7 +122,7 @@ private function mapId(ClassMetadata $class, EntityManager $em): void
$sequenceName = null;
$fieldName = $class->identifier ? $class->getSingleIdentifierFieldName() : null;

if ($platform instanceof Platforms\PostgreSQLPlatform) {
if ($platform instanceof PostgreSqlPlatform) {
$columnName = $class->getSingleIdentifierColumnName();
$quoted = isset($class->fieldMappings[$fieldName]['quoted']) || isset($class->table['quoted']);
$sequenceName = $class->getTableName() . '_' . $columnName . '_seq';
@@ -32,7 +32,7 @@ class TreeNodeEntity implements Tree\NodeInterface, \ArrayAccess

public function __construct($id = null)
{
$this->children = new ArrayCollection();
$this->childNodes = new ArrayCollection();
$this->id = $id;
}

@@ -9,7 +9,7 @@

require_once 'EntityManagerProvider.php';

class BlameableTest extends \PHPUnit_Framework_TestCase
class BlameableTest extends \PHPUnit\Framework\TestCase
{
private $subscriber;

@@ -2,7 +2,7 @@

declare(strict_types=1);

namespace tests\Knp\DoctrineBehaviors\ORM;
namespace Tests\Knp\DoctrineBehaviors\ORM;

use Doctrine\Common\EventManager;
use Doctrine\ORM\Configuration;
@@ -11,7 +11,11 @@
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
use Doctrine\ORM\Repository\DefaultRepositoryFactory;
use Doctrine\ORM\Tools\SchemaTool;
use PHPUnit\Framework\MockObject\MockBuilder;

/**
* @property-read $this \PHPUnit\Framework\TestCase
*/
trait EntityManagerProvider
{
private $em;
@@ -109,7 +113,11 @@ protected function getAnnotatedConfig()
}
}

$config = $this->getMock($configurationClass, $mockMethods);
/** @var MockBuilder $mockBuilder */
$mockBuilder = $this->getMockBuilder($configurationClass);
$mockBuilder->addMethods($mockMethods);

$config = $mockBuilder->getMock();

$config
->expects($this->once())
@@ -2,13 +2,13 @@

declare(strict_types=1);

namespace tests\Knp\DoctrineBehaviors\ORM;
namespace Tests\Knp\DoctrineBehaviors\ORM;

use BehaviorFixtures\ORM\FilterableEntity;

require_once 'EntityManagerProvider.php';

class FilterableRepositoryTest extends \PHPUnit_Framework_TestCase
class FilterableRepositoryTest extends \PHPUnit\Framework\TestCase
{
use EntityManagerProvider;

@@ -11,7 +11,7 @@

require_once 'EntityManagerProvider.php';

class GeocodableTest extends \PHPUnit_Framework_TestCase
class GeocodableTest extends \PHPUnit\Framework\TestCase
{
use EntityManagerProvider;

@@ -9,7 +9,7 @@

require_once 'EntityManagerProvider.php';

class LoggableTest extends \PHPUnit_Framework_TestCase
class LoggableTest extends \PHPUnit\Framework\TestCase
{
private $subscriber;
private $logs = [];
@@ -9,7 +9,7 @@

require_once 'EntityManagerProvider.php';

class SluggableMultiTest extends \PHPUnit_Framework_TestCase
class SluggableMultiTest extends \PHPUnit\Framework\TestCase
{
use EntityManagerProvider;

@@ -9,7 +9,7 @@

require_once 'EntityManagerProvider.php';

class SluggableTest extends \PHPUnit_Framework_TestCase
class SluggableTest extends \PHPUnit\Framework\TestCase
{
use EntityManagerProvider;

@@ -9,7 +9,7 @@

require_once 'EntityManagerProvider.php';

class SoftDeletableTest extends \PHPUnit_Framework_TestCase
class SoftDeletableTest extends \PHPUnit\Framework\TestCase
{
use EntityManagerProvider;

@@ -9,7 +9,7 @@

require_once 'EntityManagerProvider.php';

class TimestampableTest extends \PHPUnit_Framework_TestCase
class TimestampableTest extends \PHPUnit\Framework\TestCase
{
use EntityManagerProvider;

@@ -10,7 +10,7 @@

require_once 'EntityManagerProvider.php';

class TranslatableTest extends \PHPUnit_Framework_TestCase
class TranslatableTest extends \PHPUnit\Framework\TestCase
{
use EntityManagerProvider;

@@ -13,7 +13,7 @@

require_once __DIR__ . '/../EntityManagerProvider.php';

class NodeTest extends \PHPUnit_Framework_TestCase
class NodeTest extends \PHPUnit\Framework\TestCase
{
use EntityManagerProvider;

@@ -10,7 +10,7 @@
use BehaviorFixtures\ORM\TranslatableEntity;
use Knp\DoctrineBehaviors\Reflection\ClassAnalyzer;

class ClassAnalyserTest extends \PHPUnit_Framework_TestCase
class ClassAnalyserTest extends \PHPUnit\Framework\TestCase
{
/**
* @test
@@ -12,16 +12,6 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

if (!class_exists('PHPUnit_Framework_TestCase') ||
version_compare(PHPUnit_Runner_Version::id(), '3.6') < 0
) {
die('PHPUnit framework is required, at least 3.6 version');
}

if (!class_exists('PHPUnit_Framework_MockObject_MockBuilder')) {
die('PHPUnit MockObject plugin is required, at least 1.0.8 version');
}

define("DB_ENGINE", getenv("DB") ?: "pgsql");
define('DB_HOST', getenv("DB_HOST") ?: 'localhost');
define('DB_NAME', getenv("DB_NAME") ?: 'orm_behaviors_test');
@@ -32,9 +22,6 @@
define('TESTS_TEMP_DIR', __DIR__ . '/temp');
define('VENDOR_PATH', realpath(__DIR__ . '/../vendor'));

$loader = require(VENDOR_PATH . '/autoload.php');
$loader->add('BehaviorFixtures', __DIR__ . '/fixtures');

Doctrine\Common\Annotations\AnnotationRegistry::registerFile(
VENDOR_PATH . '/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php'
);

0 comments on commit 3b17cdf

Please sign in to comment.
You can’t perform that action at this time.