You are here

GlobalDrupalUnitTest.inc in Coder 8.3

Same filename and directory in other branches
  1. 8.3.x tests/DrupalPractice/Objects/GlobalDrupalUnitTest.inc

File

tests/DrupalPractice/Objects/GlobalDrupalUnitTest.inc
View source
<?php

class TestForm extends FormBase {
  public function buildForm($form, $form_state) {
    $form['something'] = \Drupal::service('foobar')
      ->result();

    // Accessing the Drupal version is fine and should not trigger a warning.
    $version = \Drupal::VERSION;
  }
  public static function example() {

    // \Drupal calls are allowed in static methods.
    return \Drupal::service('foobar')
      ->result();
  }

}

Classes

Namesort descending Description
TestForm