You are here

public function ElementTest::testOxford in Lightning Core 8.2

Same name in this branch
  1. 8.2 tests/src/Unit/ElementTest.php \Drupal\Tests\lightning_core\Unit\ElementTest::testOxford()
  2. 8.2 tests/src/Kernel/ElementTest.php \Drupal\Tests\lightning_core\Kernel\ElementTest::testOxford()
Same name and namespace in other branches
  1. 8.5 tests/src/Unit/ElementTest.php \Drupal\Tests\lightning_core\Unit\ElementTest::testOxford()
  2. 8 tests/src/Unit/ElementTest.php \Drupal\Tests\lightning_core\Unit\ElementTest::testOxford()
  3. 8.3 tests/src/Unit/ElementTest.php \Drupal\Tests\lightning_core\Unit\ElementTest::testOxford()
  4. 8.4 tests/src/Unit/ElementTest.php \Drupal\Tests\lightning_core\Unit\ElementTest::testOxford()

@covers ::oxford

File

tests/src/Unit/ElementTest.php, line 19

Class

ElementTest
@coversDefaultClass \Drupal\lightning_core\Element

Namespace

Drupal\Tests\lightning_core\Unit

Code

public function testOxford() {
  $this
    ->assertSame('foo, bar, and baz', Element::oxford([
    'foo',
    'bar',
    'baz',
  ]));
  $this
    ->assertSame('foo and bar', Element::oxford([
    'foo',
    'bar',
  ]));
  $this
    ->assertSame('foo', Element::oxford([
    'foo',
  ]));
  $this
    ->assertEmpty(Element::oxford([]));
  $this
    ->assertSame('Larry, Moe, or Curly', Element::oxford([
    'Larry',
    'Moe',
    'Curly',
  ], 'or'));
}