You are here

public function WebformObjectHelperTest::testSortByProperty in Webform 6.x

Same name and namespace in other branches
  1. 8.5 tests/src/Unit/Utility/WebformObjectHelperTest.php \Drupal\Tests\webform\Unit\Utility\WebformObjectHelperTest::testSortByProperty()

Tests sorting object by properties.

@dataProvider providerSortByProperty

Parameters

object $object: The object to run through WebformObjectHelper::sortByProperty().

array $expected: The expected result from calling the function.

See also

WebformObjectHelper::sortByProperty()

File

tests/src/Unit/Utility/WebformObjectHelperTest.php, line 29

Class

WebformObjectHelperTest
Tests webform object utility.

Namespace

Drupal\Tests\webform\Unit\Utility

Code

public function testSortByProperty($object, array $expected) {
  $result = (array) WebformObjectHelper::sortByProperty($object);
  $this
    ->assertEquals(implode('|', array_keys($expected)), implode('|', array_keys($result)));
}