public function FeedRefreshTest::setUp in Feeds 8.3
Overrides FeedsUnitTestCase::setUp
File
- tests/
src/ Unit/ Plugin/ QueueWorker/ FeedRefreshTest.php, line 56
Class
- FeedRefreshTest
- @coversDefaultClass \Drupal\feeds\Plugin\QueueWorker\FeedRefresh @group feeds
Namespace
Drupal\Tests\feeds\Unit\Plugin\QueueWorkerCode
public function setUp() {
parent::setUp();
$this->dispatcher = new EventDispatcher();
$queue_factory = $this
->createMock(QueueFactory::class, [], [], '', FALSE);
$queue_factory
->expects($this
->any())
->method('get')
->with('feeds_feed_refresh:')
->will($this
->returnValue($this
->createMock(QueueInterface::class)));
$entity_type_manager = $this
->createMock(EntityTypeManagerInterface::class);
$messenger = $this
->createMock(MessengerInterface::class);
$executable = new FeedsQueueExecutable($entity_type_manager, $this->dispatcher, $this
->getMockedAccountSwitcher(), $messenger, $queue_factory);
$executable
->setStringTranslation($this
->getStringTranslationStub());
$this->plugin = $this
->getMockBuilder(FeedRefresh::class)
->setMethods([
'feedExists',
'getExecutable',
])
->setConstructorArgs([
[],
'feeds_feed_refresh',
[],
$queue_factory,
$this->dispatcher,
$this
->getMockedAccountSwitcher(),
$entity_type_manager,
])
->getMock();
$this->plugin
->expects($this
->any())
->method('feedExists')
->will($this
->returnValue(TRUE));
$this->plugin
->expects($this
->any())
->method('getExecutable')
->will($this
->returnValue($executable));
$connection = $this
->prophesize(Connection::class);
$connection
->query(Argument::type('string'), Argument::type('array'))
->willReturn($this
->createMock(StatementInterface::class));
$this->feed = $this
->getMockFeed();
$this->feed
->expects($this
->any())
->method('getState')
->with(StateInterface::CLEAN)
->will($this
->returnValue(new CleanState(1, $connection
->reveal())));
}