You are here

ImageFieldMappingTest.php in FillPDF 8.4

Same filename and directory in other branches
  1. 5.0.x tests/src/Unit/FieldMapping/ImageFieldMappingTest.php

File

tests/src/Unit/FieldMapping/ImageFieldMappingTest.php
View source
<?php

namespace Drupal\Tests\fillpdf\Unit\FieldMapping;

use Drupal\fillpdf\FieldMapping\ImageFieldMapping;
use Drupal\Tests\UnitTestCase;

/**
 * Test the ImageFieldMapping class.
 *
 * @group fillpdf
 * @covers \Drupal\fillpdf\FieldMapping\ImageFieldMapping
 */
class ImageFieldMappingTest extends UnitTestCase {

  /**
   * Test the constructor.
   */
  public function testConstruct() {

    // Test valid and invalid instantiations.
    $image_field_mapping = new ImageFieldMapping('Dummy image', 'jpg');
    self::assertInstanceOf(ImageFieldMapping::class, $image_field_mapping);
    $this
      ->setExpectedException(\InvalidArgumentException::class);
    new ImageFieldMapping('Dummy image', 'bmp');
  }

  /**
   * Test the getExtension() method.
   */
  public function testGetExtension() {
    $image_field_mapping = new ImageFieldMapping('Dummy image', 'jpg');
    self::assertEquals('jpg', $image_field_mapping
      ->getExtension());
  }

}

Classes

Namesort descending Description
ImageFieldMappingTest Test the ImageFieldMapping class.