Skip to content

Commit 332dffc

Browse files
Merge branch '4.4' into 5.1
* 4.4: Use createMock() and use import instead of FQCN
2 parents f008f55 + c352647 commit 332dffc

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Tests/Debug/WrappedListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class WrappedListenerTest extends TestCase
2323
*/
2424
public function testListenerDescription($listener, $expected)
2525
{
26-
$wrappedListener = new WrappedListener($listener, null, $this->getMockBuilder(Stopwatch::class)->getMock(), $this->getMockBuilder(EventDispatcherInterface::class)->getMock());
26+
$wrappedListener = new WrappedListener($listener, null, $this->createMock(Stopwatch::class), $this->createMock(EventDispatcherInterface::class));
2727

2828
$this->assertStringMatchesFormat($expected, $wrappedListener->getPretty());
2929
}

Tests/EventDispatcherTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public function testAddSubscriberWithPriorities()
213213
$listeners = $this->dispatcher->getListeners('pre.foo');
214214
$this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
215215
$this->assertCount(2, $listeners);
216-
$this->assertInstanceOf(\Symfony\Component\EventDispatcher\Tests\TestEventSubscriberWithPriorities::class, $listeners[0][0]);
216+
$this->assertInstanceOf(TestEventSubscriberWithPriorities::class, $listeners[0][0]);
217217
}
218218

219219
public function testAddSubscriberWithMultipleListeners()

Tests/ImmutableEventDispatcherTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
use PHPUnit\Framework\MockObject\MockObject;
1515
use PHPUnit\Framework\TestCase;
16+
use Symfony\Component\EventDispatcher\Event;
17+
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
18+
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
1619
use Symfony\Component\EventDispatcher\ImmutableEventDispatcher;
1720
use Symfony\Contracts\EventDispatcher\Event;
1821

@@ -33,7 +36,7 @@ class ImmutableEventDispatcherTest extends TestCase
3336

3437
protected function setUp(): void
3538
{
36-
$this->innerDispatcher = $this->getMockBuilder(\Symfony\Component\EventDispatcher\EventDispatcherInterface::class)->getMock();
39+
$this->innerDispatcher = $this->createMock(EventDispatcherInterface::class);
3740
$this->dispatcher = new ImmutableEventDispatcher($this->innerDispatcher);
3841
}
3942

@@ -79,7 +82,7 @@ public function testAddListenerDisallowed()
7982
public function testAddSubscriberDisallowed()
8083
{
8184
$this->expectException(\BadMethodCallException::class);
82-
$subscriber = $this->getMockBuilder(\Symfony\Component\EventDispatcher\EventSubscriberInterface::class)->getMock();
85+
$subscriber = $this->createMock(EventSubscriberInterface::class);
8386

8487
$this->dispatcher->addSubscriber($subscriber);
8588
}
@@ -93,7 +96,7 @@ public function testRemoveListenerDisallowed()
9396
public function testRemoveSubscriberDisallowed()
9497
{
9598
$this->expectException(\BadMethodCallException::class);
96-
$subscriber = $this->getMockBuilder(\Symfony\Component\EventDispatcher\EventSubscriberInterface::class)->getMock();
99+
$subscriber = $this->createMock(EventSubscriberInterface::class);
97100

98101
$this->dispatcher->removeSubscriber($subscriber);
99102
}

0 commit comments

Comments
 (0)