You are here

public function DefaultFieldComparatorTest::testImageWithAltWithoutTitleFieldProperties in Changed Fields API 8.3

Default field comparator: image field's property(s)

Test image field properties with alt but without title.

File

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

Class

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

Namespace

Drupal\Tests\changed_fields\Unit

Code

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