You are here

protected function InstantArticleRssContentEntityNormalizerTest::getContentEntityNormalizer in Facebook Instant Articles 8.2

Same name and namespace in other branches
  1. 3.x tests/src/Unit/InstantArticleRssContentEntityNormalizerTest.php \Drupal\Tests\fb_instant_articles\Unit\InstantArticleRssContentEntityNormalizerTest::getContentEntityNormalizer()

Helper function to create a new FBIA RSS normalizer for testing.

Parameters

array $settings: Global config settings.

array $components: Entity view display components.

Return value

\Drupal\fb_instant_articles\Normalizer\InstantArticleContentEntityNormalizer Content entity normalizer object to test against.

2 calls to InstantArticleRssContentEntityNormalizerTest::getContentEntityNormalizer()
InstantArticleRssContentEntityNormalizerTest::testNormalize in tests/src/Unit/InstantArticleRssContentEntityNormalizerTest.php
Tests the normalize() method.
InstantArticleRssContentEntityNormalizerTest::testSupportsNormalization in tests/src/Unit/InstantArticleRssContentEntityNormalizerTest.php
Tests the supportsNormalization() method.

File

tests/src/Unit/InstantArticleRssContentEntityNormalizerTest.php, line 81

Class

InstantArticleRssContentEntityNormalizerTest
Tests the fbia content entity normalizer class.

Namespace

Drupal\Tests\fb_instant_articles\Unit

Code

protected function getContentEntityNormalizer(array $settings = [], array $components = []) {
  $config_factory = $this
    ->getConfigFactoryStub([
    'fb_instant_articles.settings' => $settings,
  ]);
  $content_entity_normalizer = $this
    ->getMockBuilder(InstantArticleRssContentEntityNormalizer::class)
    ->setConstructorArgs([
    $config_factory,
  ])
    ->addMethods([
    'getApplicableComponents',
    'getApplicationVersion',
  ])
    ->getMock();
  $content_entity_normalizer
    ->method('getApplicableComponents')
    ->willReturn($components);
  $content_entity_normalizer
    ->method('getApplicationVersion')
    ->willReturn('8.x-2.x');
  $serializer = $this
    ->createMock(Serializer::class);
  $serializer
    ->method('normalize')
    ->willReturn(InstantArticle::create());
  $content_entity_normalizer
    ->setSerializer($serializer);
  return $content_entity_normalizer;
}