Skip to content

Commit

Permalink
Merge pull request #21 from antistatique/2.0.x--fix-deprecaed-getMock…
Browse files Browse the repository at this point in the history
…Builder

fix usage of deprecated getMockBuilder by createMock
  • Loading branch information
WengerK authored Jan 27, 2023
2 parents ce977aa + 980612f commit c967e92
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 75 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- fix usage of deprecated getMockBuilder by createMock

## [2.0.0] - 2022-12-16
### Changed
Expand Down
20 changes: 5 additions & 15 deletions tests/src/Unit/Resolver/DailyResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,15 @@ class DailyResolverTest extends UnitTestCase {
* {@inheritdoc}
*/
public function setUp(): void {
$this->cacheTagsInvalidator = $this->getMockBuilder(CacheTagsInvalidatorInterface::class)
->disableOriginalConstructor()
->getMock();
$this->cacheTagsInvalidator = $this->createMock(CacheTagsInvalidatorInterface::class);

$this->state = $this->getMockBuilder(StateInterface::class)
->disableOriginalConstructor()
->getMock();
$this->state = $this->createMock(StateInterface::class);

$this->time = $this->getMockBuilder(TimeInterface::class)
->disableOriginalConstructor()
->getMock();
$this->time = $this->createMock(TimeInterface::class);

$this->logger = $this->getMockBuilder(LoggerChannelInterface::class)
->disableOriginalConstructor()
->getMock();
$this->logger = $this->createMock(LoggerChannelInterface::class);

$this->loggerFactory = $this->getMockBuilder(LoggerChannelFactoryInterface::class)
->disableOriginalConstructor()
->getMock();
$this->loggerFactory = $this->createMock(LoggerChannelFactoryInterface::class);
$this->loggerFactory->expects($this->once())
->method('get')->with('timesup')->willReturn($this->logger);
}
Expand Down
20 changes: 5 additions & 15 deletions tests/src/Unit/Resolver/HourlyResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,15 @@ class HourlyResolverTest extends UnitTestCase {
* {@inheritdoc}
*/
public function setUp(): void {
$this->cacheTagsInvalidator = $this->getMockBuilder(CacheTagsInvalidatorInterface::class)
->disableOriginalConstructor()
->getMock();
$this->cacheTagsInvalidator = $this->createMock(CacheTagsInvalidatorInterface::class);

$this->state = $this->getMockBuilder(StateInterface::class)
->disableOriginalConstructor()
->getMock();
$this->state = $this->createMock(StateInterface::class);

$this->time = $this->getMockBuilder(TimeInterface::class)
->disableOriginalConstructor()
->getMock();
$this->time = $this->createMock(TimeInterface::class);

$this->logger = $this->getMockBuilder(LoggerChannelInterface::class)
->disableOriginalConstructor()
->getMock();
$this->logger = $this->createMock(LoggerChannelInterface::class);

$this->loggerFactory = $this->getMockBuilder(LoggerChannelFactoryInterface::class)
->disableOriginalConstructor()
->getMock();
$this->loggerFactory = $this->createMock(LoggerChannelFactoryInterface::class);
$this->loggerFactory->expects($this->once())
->method('get')->with('timesup')->willReturn($this->logger);
}
Expand Down
20 changes: 5 additions & 15 deletions tests/src/Unit/Resolver/MidnightResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,15 @@ final class MidnightResolverTest extends UnitTestCase {
* {@inheritdoc}
*/
public function setUp(): void {
$this->cacheTagsInvalidator = $this->getMockBuilder(CacheTagsInvalidatorInterface::class)
->disableOriginalConstructor()
->getMock();
$this->cacheTagsInvalidator = $this->createMock(CacheTagsInvalidatorInterface::class);

$this->state = $this->getMockBuilder(StateInterface::class)
->disableOriginalConstructor()
->getMock();
$this->state = $this->createMock(StateInterface::class);

$this->time = $this->getMockBuilder(TimeInterface::class)
->disableOriginalConstructor()
->getMock();
$this->time = $this->createMock(TimeInterface::class);

$this->logger = $this->getMockBuilder(LoggerChannelInterface::class)
->disableOriginalConstructor()
->getMock();
$this->logger = $this->createMock(LoggerChannelInterface::class);

$this->loggerFactory = $this->getMockBuilder(LoggerChannelFactoryInterface::class)
->disableOriginalConstructor()
->getMock();
$this->loggerFactory = $this->createMock(LoggerChannelFactoryInterface::class);
$this->loggerFactory->expects($this->once())
->method('get')->with('timesup')->willReturn($this->logger);
}
Expand Down
20 changes: 5 additions & 15 deletions tests/src/Unit/Resolver/MinutelyResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,15 @@ class MinutelyResolverTest extends UnitTestCase {
* {@inheritdoc}
*/
public function setUp(): void {
$this->cacheTagsInvalidator = $this->getMockBuilder(CacheTagsInvalidatorInterface::class)
->disableOriginalConstructor()
->getMock();
$this->cacheTagsInvalidator = $this->createMock(CacheTagsInvalidatorInterface::class);

$this->state = $this->getMockBuilder(StateInterface::class)
->disableOriginalConstructor()
->getMock();
$this->state = $this->createMock(StateInterface::class);

$this->time = $this->getMockBuilder(TimeInterface::class)
->disableOriginalConstructor()
->getMock();
$this->time = $this->createMock(TimeInterface::class);

$this->logger = $this->getMockBuilder(LoggerChannelInterface::class)
->disableOriginalConstructor()
->getMock();
$this->logger = $this->createMock(LoggerChannelInterface::class);

$this->loggerFactory = $this->getMockBuilder(LoggerChannelFactoryInterface::class)
->disableOriginalConstructor()
->getMock();
$this->loggerFactory = $this->createMock(LoggerChannelFactoryInterface::class);
$this->loggerFactory->expects($this->once())
->method('get')->with('timesup')->willReturn($this->logger);
}
Expand Down
20 changes: 5 additions & 15 deletions tests/src/Unit/Resolver/WeeklyResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,15 @@ class WeeklyResolverTest extends UnitTestCase {
* {@inheritdoc}
*/
public function setUp(): void {
$this->cacheTagsInvalidator = $this->getMockBuilder(CacheTagsInvalidatorInterface::class)
->disableOriginalConstructor()
->getMock();
$this->cacheTagsInvalidator = $this->createMock(CacheTagsInvalidatorInterface::class);

$this->state = $this->getMockBuilder(StateInterface::class)
->disableOriginalConstructor()
->getMock();
$this->state = $this->createMock(StateInterface::class);

$this->time = $this->getMockBuilder(TimeInterface::class)
->disableOriginalConstructor()
->getMock();
$this->time = $this->createMock(TimeInterface::class);

$this->logger = $this->getMockBuilder(LoggerChannelInterface::class)
->disableOriginalConstructor()
->getMock();
$this->logger = $this->createMock(LoggerChannelInterface::class);

$this->loggerFactory = $this->getMockBuilder(LoggerChannelFactoryInterface::class)
->disableOriginalConstructor()
->getMock();
$this->loggerFactory = $this->createMock(LoggerChannelFactoryInterface::class);
$this->loggerFactory->expects($this->once())
->method('get')->with('timesup')->willReturn($this->logger);
}
Expand Down

0 comments on commit c967e92

Please sign in to comment.