You are here

public function LazySubscriberTest::testOnInitExpire in Feeds 8.3

@covers ::onInitExpire

File

tests/src/Unit/EventSubscriber/LazySubscriberTest.php, line 198

Class

LazySubscriberTest
@coversDefaultClass \Drupal\feeds\EventSubscriber\LazySubscriber @group feeds

Namespace

Drupal\Tests\feeds\Unit\EventSubscriber

Code

public function testOnInitExpire() {
  $this->feedType
    ->expects($this
    ->once())
    ->method('getProcessor')
    ->will($this
    ->returnValue($this->processor));
  $this->processor
    ->expects($this
    ->once())
    ->method('expireItem')
    ->with($this->feed);
  $subscriber = new LazySubscriber();
  $subscriber
    ->onInitExpire(new InitEvent($this->feed), FeedsEvents::INIT_IMPORT, $this->dispatcher);
  $this->dispatcher
    ->dispatch(FeedsEvents::EXPIRE, new ExpireEvent($this->feed, 1234));

  // Call again.
  $subscriber
    ->onInitExpire(new InitEvent($this->feed), FeedsEvents::INIT_IMPORT, $this->explodingDispatcher);
}