Skip to content

Commit

Permalink
EntityManagerFactoryTest split out assets
Browse files Browse the repository at this point in the history
  • Loading branch information
TomHAnderson committed Oct 27, 2024
1 parent 4eadc16 commit eb6cd60
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 44 deletions.
7 changes: 7 additions & 0 deletions tests/Assets/AnotherListenerStub.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace LaravelDoctrineTest\ORM\Assets;

class AnotherListenerStub
{
}
9 changes: 9 additions & 0 deletions tests/Assets/Decorator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace LaravelDoctrineTest\ORM\Assets;

use Doctrine\ORM\Decorator\EntityManagerDecorator;

class Decorator extends EntityManagerDecorator
{
}
9 changes: 9 additions & 0 deletions tests/Assets/FakeConnection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace LaravelDoctrineTest\ORM\Assets;

use Doctrine\DBAL\Connection;

class FakeConnection extends Connection
{
}
7 changes: 7 additions & 0 deletions tests/Assets/FakeEventManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace LaravelDoctrineTest\ORM\Assets;

class FakeEventManager extends \Doctrine\Common\EventManager
{
}
11 changes: 11 additions & 0 deletions tests/Assets/FilterStub.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace LaravelDoctrineTest\ORM\Assets;

class FilterStub extends \Doctrine\ORM\Query\Filter\SQLFilter
{
public function addFilterConstraint(\Doctrine\ORM\Mapping\ClassMetadata $targetEntity, string $targetTableAlias): string
{
return '';
}
}
7 changes: 7 additions & 0 deletions tests/Assets/ListenerStub.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace LaravelDoctrineTest\ORM\Assets;

class ListenerStub
{
}
19 changes: 19 additions & 0 deletions tests/Assets/SubscriberStub.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace LaravelDoctrineTest\ORM\Assets;

use Doctrine\Common\EventSubscriber;

class SubscriberStub implements EventSubscriber
{
/**
* Returns an array of events this subscriber wants to listen to.
* @return array
*/
public function getSubscribedEvents()
{
return [
'onFlush'
];
}
}
56 changes: 12 additions & 44 deletions tests/Feature/EntityManagerFactoryTest.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace LaravelDoctrineTest\ORM\Feature;

use Doctrine\Common\Cache\Cache;
use Doctrine\Common\EventSubscriber;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Connections\PrimaryReadReplicaConnection;
use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory;
use Doctrine\ORM\Cache\CacheFactory;
use Doctrine\ORM\Cache\RegionsConfiguration;
use Doctrine\ORM\Configuration;
use Doctrine\ORM\Decorator\EntityManagerDecorator;
use Doctrine\ORM\EntityManagerInterface;
Expand All @@ -15,6 +15,7 @@
use Doctrine\Persistence\Mapping\Driver\MappingDriver;
use Illuminate\Contracts\Config\Repository;
use Illuminate\Contracts\Container\Container;
use InvalidArgumentException;
use LaravelDoctrine\ORM\Configuration\Cache\CacheManager;
use LaravelDoctrine\ORM\Configuration\Connections\ConnectionManager;
use LaravelDoctrine\ORM\Configuration\LaravelNamingStrategy;
Expand All @@ -24,10 +25,19 @@
use LaravelDoctrine\ORM\Resolvers\EntityListenerResolver;
use LaravelDoctrine\ORM\ORMSetupResolver;
use LaravelDoctrine\ORM\Testing\ConfigRepository;
use LaravelDoctrineTest\ORM\Assets\AnotherListenerStub;
use LaravelDoctrineTest\ORM\Assets\Decorator;
use LaravelDoctrineTest\ORM\Assets\FakeConnection;
use LaravelDoctrineTest\ORM\Assets\FakeEventManager;
use LaravelDoctrineTest\ORM\Assets\FilterStub;
use LaravelDoctrineTest\ORM\Assets\ListenerStub;
use LaravelDoctrineTest\ORM\Assets\SubscriberStub;
use Mockery as m;
use Mockery\Mock;
use PHPUnit\Framework\TestCase;
use Psr\Cache\CacheItemPoolInterface;
use ReflectionException;
use ReflectionObject;
use Symfony\Component\Cache\Adapter\ArrayAdapter;

class EntityManagerFactoryTest extends TestCase
Expand Down Expand Up @@ -1208,45 +1218,3 @@ private function getDummyBaseInputConfig()
];
}
}

class FakeEventManager extends \Doctrine\Common\EventManager
{
}

class FakeConnection extends Connection
{
}

class FilterStub extends \Doctrine\ORM\Query\Filter\SQLFilter
{
public function addFilterConstraint(\Doctrine\ORM\Mapping\ClassMetadata $targetEntity, string $targetTableAlias): string
{
return '';
}
}

class ListenerStub
{
}

class AnotherListenerStub
{
}

class SubscriberStub implements EventSubscriber
{
/**
* Returns an array of events this subscriber wants to listen to.
* @return array
*/
public function getSubscribedEvents()
{
return [
'onFlush'
];
}
}

class Decorator extends EntityManagerDecorator
{
}

0 comments on commit eb6cd60

Please sign in to comment.