Skip to content
Snippets Groups Projects

Split the code and added a test

1 unresolved thread

Closes #3204558

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
521 498 return $result;
522 499 }
523 500
501 /**
502 * Gets the default handlers for a field's data column.
503 *
504 * @param string $column_type
505 * The type of data stored in the field's database table column.
506 * @param string $field_type
507 * The ID of the field's type plugin.
508 *
509 * @return string[]
510 * An array containing the IDs of Views handlers in the following order:
511 * filter, argument, sort.
512 */
513 public function getHandlers(string $column_type, string $field_type): array {
  • Why move to custom function if only called once?

  • @smustgrave I started to write a test and then decided "There is no way I'm writing a Unit test that covers an entire, complicated, nearly 500 line function." So I split the offending code out into its own function in the same class.

    defaultFieldImplementation() is too big as it is. If we want this code to be more testable, then it needs to be broken up. This is just one step toward doing that. No, it isn't strictly necessary from a functionality standpoint. But I will argue that it's necessary for sanity.

  • Please register or sign in to reply
  • Stephen Mustgrave left review comments

    left review comments

  • Please register or sign in to reply
    Loading