You are here

public function DefaultFieldComparatorTest::testImageWithAltAndTitleFieldProperties in Changed Fields API 8.3

Default field comparator: image field's property(s) (with alt and title).

File

tests/src/Unit/DefaultFieldComparatorTest.php, line 384

Class

DefaultFieldComparatorTest
@coversDefaultClass \Drupal\changed_fields\Plugin\FieldComparator\DefaultFieldComparator

Namespace

Drupal\Tests\changed_fields\Unit

Code

public function testImageWithAltAndTitleFieldProperties() {
  $this->fieldDefinitionMock
    ->expects($this
    ->once())
    ->method('getType')
    ->willReturn('image');
  $this->fieldDefinitionMock
    ->expects($this
    ->any())
    ->method('getSetting')
    ->willReturn(TRUE);
  $properties = $this
    ->invokeMethod($this->fieldComparator, 'getComparableProperties', [
    $this->fieldDefinitionMock,
  ]);
  $this
    ->assertArrayEquals([
    'width',
    'height',
    'target_id',
    'alt',
    'title',
  ], $properties);
}