public function assertRolesExist(TableNode $expected) {
    $role_info = [];
    /** @var \Drupal\user\Entity\Role[] $roles */
    $roles = $this->entityTypeManager()
      ->getStorage('user_role')
      ->loadMultiple();
    foreach ($roles as $id => $role) {
      $role_info[] = [$role->label(), $id];
    }
    $actual = new TableNode($role_info);

    (new TableEqualityAssertion($expected, $actual))
      ->expectHeader(['Name', 'Machine name'])
      ->ignoreRowOrder()
      ->setMissingRowsLabel(self::missingRowsLabelFor('roles'))
      ->setUnexpectedRowsLabel(self::unexpectedRowsLabelFor('roles'))
      ->assert();
  }
public function assertRolesExist(TableNode $expected) {
    $role_info = [];
    /** @var \Drupal\user\Entity\Role[] $roles */
    $roles = $this->entityTypeManager()
      ->getStorage('user_role')
      ->loadMultiple();
    foreach ($roles as $id => $role) {
      $role_info[] = [$role->label(), $id];
    }
    $actual = new TableNode($role_info);

    (new TableEqualityAssertion($expected, $actual))
      ->expectHeader(['Name', 'Machine name'])
      ->ignoreRowOrder()
      ->setMissingRowsLabel(self::missingRowsLabelFor('roles'))
      ->setUnexpectedRowsLabel(self::unexpectedRowsLabelFor('roles'))
      ->assert();
  }
public function assertRolesExist ( TableNode $ expected ) { $ role_info = [ ] ; /** @var \Drupal\user\Entity\Role[] $roles */ $ roles = $ this -> entityTypeManager ( ) -> getStorage ( 'user_role' ) -> loadMultiple ( ) ; foreach ( $ roles as $ id => $ role ) { $ role_info [ ] = [ $ role -> label ( ) , $ id ] ; } $ actual = new TableNode ( $ role_info ) ; ( new TableEqualityAssertion ( $ expected , $ actual ) ) -> expectHeader ( [ 'Name' , 'Machine name' ] ) -> ignoreRowOrder ( ) -> setMissingRowsLabel ( self :: missingRowsLabelFor ( 'roles' ) ) -> setUnexpectedRowsLabel ( self :: unexpectedRowsLabelFor ( 'roles' ) ) -> assert ( ) ; }
Asserts the configuration of roles.

@Then exactly the following roles should exist

@throws \Exception
Asserts the configuration of roles .