Skip to content

Commit

Permalink
Merge pull request #11 from peter-gribanov/update_phpunit
Browse files Browse the repository at this point in the history
Use PHPUnit 4.8.36 with namespaces
  • Loading branch information
peter-gribanov committed Mar 25, 2020
2 parents 2478554 + 23218cd commit c8edce5
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 55 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Expand Up @@ -26,9 +26,7 @@ matrix:
dist: trusty
env: SYMFONY_VERSION=3.4.*
- php: 7.1
env: SYMFONY_VERSION=4.2.* PHPUNIT_VERSION=5.7.*
- php: 7.1
env: SYMFONY_VERSION=4.3.* PHPUNIT_VERSION=5.7.*
env: SYMFONY_VERSION=4.4.* PHPUNIT_VERSION=6.5.*
- php: 5.5
dist: trusty
env: DOCTRINE_VERSION=2.5.*
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -23,7 +23,7 @@
"doctrine/orm": "~2.4|~2.5|~2.6"
},
"require-dev": {
"phpunit/phpunit": "~4.8",
"phpunit/phpunit": "^4.8.36",
"scrutinizer/ocular": "~1.5",
"satooshi/php-coveralls": "^2.0"
},
Expand Down
3 changes: 2 additions & 1 deletion tests/DependencyInjection/Compiler/EventListenerPassTest.php
Expand Up @@ -11,10 +11,11 @@
namespace GpsLab\Bundle\DomainEvent\Tests\DependencyInjection\Compiler;

use GpsLab\Bundle\DomainEvent\DependencyInjection\Compiler\EventListenerPass;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;

class EventListenerPassTest extends \PHPUnit_Framework_TestCase
class EventListenerPassTest extends TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|ContainerBuilder
Expand Down
3 changes: 2 additions & 1 deletion tests/DependencyInjection/ConfigurationTest.php
Expand Up @@ -11,11 +11,12 @@
namespace GpsLab\Bundle\DomainEvent\Tests\DependencyInjection;

use GpsLab\Bundle\DomainEvent\DependencyInjection\Configuration;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\ArrayNode;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ScalarNode;

class ConfigurationTest extends \PHPUnit_Framework_TestCase
class ConfigurationTest extends TestCase
{
/**
* @var Configuration
Expand Down
3 changes: 2 additions & 1 deletion tests/DependencyInjection/GpsLabDomainEventExtensionTest.php
Expand Up @@ -14,9 +14,10 @@
use GpsLab\Domain\Event\Bus\EventBus;
use GpsLab\Domain\Event\Listener\Subscriber;
use GpsLab\Domain\Event\Queue\EventQueue;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class GpsLabDomainEventExtensionTest extends \PHPUnit_Framework_TestCase
class GpsLabDomainEventExtensionTest extends TestCase
{
/**
* @var GpsLabDomainEventExtension
Expand Down
43 changes: 22 additions & 21 deletions tests/Event/Listener/DomainEventPublisherTest.php
Expand Up @@ -19,8 +19,9 @@
use GpsLab\Bundle\DomainEvent\Service\EventPuller;
use GpsLab\Domain\Event\Bus\EventBus;
use GpsLab\Domain\Event\Event;
use PHPUnit\Framework\TestCase;

class DomainEventPublisherTest extends \PHPUnit_Framework_TestCase
class DomainEventPublisherTest extends TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|EventBus
Expand Down Expand Up @@ -59,9 +60,9 @@ class DomainEventPublisherTest extends \PHPUnit_Framework_TestCase

protected function setUp()
{
$this->bus = $this->getMock(EventBus::class);
$this->puller = $this->getMock(EventPuller::class);
$this->em = $this->getMock(EntityManagerInterface::class);
$this->bus = $this->getMockBuilder(EventBus::class)->getMock();
$this->puller = $this->getMockBuilder(EventPuller::class)->getMock();
$this->em = $this->getMockBuilder(EntityManagerInterface::class)->getMock();

$this->on_flush = $this
->getMockBuilder(OnFlushEventArgs::class)
Expand Down Expand Up @@ -129,15 +130,15 @@ public function testPreFlush()
public function events()
{
$events1 = [
$this->getMock(Event::class),
$this->getMock(Event::class),
$this->getMock(Event::class),
$this->getMockBuilder(Event::class)->getMock(),
$this->getMockBuilder(Event::class)->getMock(),
$this->getMockBuilder(Event::class)->getMock(),
];
$events2 = [
$this->getMock(Event::class),
$this->getMock(Event::class),
$this->getMock(Event::class),
$this->getMock(Event::class),
$this->getMockBuilder(Event::class)->getMock(),
$this->getMockBuilder(Event::class)->getMock(),
$this->getMockBuilder(Event::class)->getMock(),
$this->getMockBuilder(Event::class)->getMock(),
];

return [
Expand Down Expand Up @@ -206,22 +207,22 @@ public function testPublishEvents(array $remove_events, array $exist_events)
public function testRecursivePublish()
{
$remove_events1 = [
$this->getMock(Event::class),
$this->getMock(Event::class),
$this->getMockBuilder(Event::class)->getMock(),
$this->getMockBuilder(Event::class)->getMock(),
];
$remove_events2 = [
$this->getMock(Event::class),
$this->getMock(Event::class),
$this->getMock(Event::class),
$this->getMockBuilder(Event::class)->getMock(),
$this->getMockBuilder(Event::class)->getMock(),
$this->getMockBuilder(Event::class)->getMock(),
];
$exist_events1 = [
$this->getMock(Event::class),
$this->getMock(Event::class),
$this->getMockBuilder(Event::class)->getMock(),
$this->getMockBuilder(Event::class)->getMock(),
];
$exist_events2 = [
$this->getMock(Event::class),
$this->getMock(Event::class),
$this->getMock(Event::class),
$this->getMockBuilder(Event::class)->getMock(),
$this->getMockBuilder(Event::class)->getMock(),
$this->getMockBuilder(Event::class)->getMock(),
];

$this->em
Expand Down
3 changes: 2 additions & 1 deletion tests/GpsLabDomainEventBundleTest.php
Expand Up @@ -12,10 +12,11 @@
use GpsLab\Bundle\DomainEvent\DependencyInjection\Compiler\EventListenerPass;
use GpsLab\Bundle\DomainEvent\DependencyInjection\GpsLabDomainEventExtension;
use GpsLab\Bundle\DomainEvent\GpsLabDomainEventBundle;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

class GpsLabDomainEventBundleTest extends \PHPUnit_Framework_TestCase
class GpsLabDomainEventBundleTest extends TestCase
{
/**
* @var GpsLabDomainEventBundle
Expand Down
53 changes: 27 additions & 26 deletions tests/Service/EventPullerTest.php
Expand Up @@ -15,8 +15,9 @@
use GpsLab\Bundle\DomainEvent\Service\EventPuller;
use GpsLab\Domain\Event\Aggregator\AggregateEvents;
use GpsLab\Domain\Event\Event;
use PHPUnit\Framework\TestCase;

class EventPullerTest extends \PHPUnit_Framework_TestCase
class EventPullerTest extends TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|UnitOfWork
Expand Down Expand Up @@ -45,26 +46,26 @@ protected function setUp()
public function events()
{
$events1 = [
$this->getMock(Event::class),
$this->getMock(Event::class),
$this->getMock(Event::class),
$this->getMock(Event::class),
$this->getMock(Event::class),
$this->getMockBuilder(Event::class)->getMock(),
$this->getMockBuilder(Event::class)->getMock(),
$this->getMockBuilder(Event::class)->getMock(),
$this->getMockBuilder(Event::class)->getMock(),
$this->getMockBuilder(Event::class)->getMock(),
];
$events2 = [
$this->getMock(Event::class),
$this->getMock(Event::class),
$this->getMock(Event::class),
$this->getMock(Event::class),
$this->getMockBuilder(Event::class)->getMock(),
$this->getMockBuilder(Event::class)->getMock(),
$this->getMockBuilder(Event::class)->getMock(),
$this->getMockBuilder(Event::class)->getMock(),
];
$events3 = [
$this->getMock(Event::class),
$this->getMock(Event::class),
$this->getMock(Event::class),
$this->getMockBuilder(Event::class)->getMock(),
$this->getMockBuilder(Event::class)->getMock(),
$this->getMockBuilder(Event::class)->getMock(),
];
$events4 = [
$this->getMock(Event::class),
$this->getMock(Event::class),
$this->getMockBuilder(Event::class)->getMock(),
$this->getMockBuilder(Event::class)->getMock(),
];

return [
Expand All @@ -89,10 +90,10 @@ public function events()
/**
* @dataProvider events
*
* @param array $deletions_events
* @param array $insertions_events
* @param array $updates_events
* @param array $map_events
* @param \PHPUnit_Framework_MockObject_MockObject[] $deletions_events
* @param \PHPUnit_Framework_MockObject_MockObject[] $insertions_events
* @param \PHPUnit_Framework_MockObject_MockObject[] $updates_events
* @param \PHPUnit_Framework_MockObject_MockObject[] $map_events
*/
public function testPull(
array $deletions_events,
Expand All @@ -102,20 +103,20 @@ public function testPull(
) {
if ($map_events) {
$slice = round(count($map_events) / 2);
$aggregator1 = $this->getMock(AggregateEvents::class);
$aggregator1 = $this->getMockBuilder(AggregateEvents::class)->getMock();
$aggregator1
->expects($this->once())
->method('pullEvents')
->will($this->returnValue(array_slice($map_events, 0, $slice)));
$aggregator2 = $this->getMock(AggregateEvents::class);
$aggregator2 = $this->getMockBuilder(AggregateEvents::class)->getMock();
$aggregator2
->expects($this->once())
->method('pullEvents')
->will($this->returnValue(array_slice($map_events, $slice)));

$map = [
[
$this->getMock(Proxy::class),
$this->getMockBuilder(Proxy::class)->getMock(),
$aggregator1,
],
[
Expand All @@ -124,7 +125,7 @@ public function testPull(
],
[
new \stdClass(),
$this->getMock(Proxy::class),
$this->getMockBuilder(Proxy::class)->getMock(),
],
];
} else {
Expand Down Expand Up @@ -174,21 +175,21 @@ private function getEntitiesFroEvents(array $events)
}

$slice = round(count($events) / 2);
$aggregator1 = $this->getMock(AggregateEvents::class);
$aggregator1 = $this->getMockBuilder(AggregateEvents::class)->getMock();
$aggregator1
->expects($this->once())
->method('pullEvents')
->will($this->returnValue(array_slice($events, 0, $slice)))
;
$aggregator2 = $this->getMock(AggregateEvents::class);
$aggregator2 = $this->getMockBuilder(AggregateEvents::class)->getMock();
$aggregator2
->expects($this->once())
->method('pullEvents')
->will($this->returnValue(array_slice($events, $slice)))
;

return [
$this->getMock(Proxy::class),
$this->getMockBuilder(Proxy::class)->getMock(),
new \stdClass(),
$aggregator1,
$aggregator2,
Expand Down

0 comments on commit c8edce5

Please sign in to comment.