You are here

public function MeasurementTest::testGetters in Physical Fields 8

Tests the methods for getting the number and unit in various formats.

::covers getNumber ::covers getUnit ::covers __toString ::covers toArray.

File

tests/src/Unit/MeasurementTest.php, line 48

Class

MeasurementTest
Tests the measurement base class.

Namespace

Drupal\Tests\physical\Unit

Code

public function testGetters() {
  $this
    ->assertEquals('10', $this->measurement
    ->getNumber());
  $this
    ->assertEquals('m', $this->measurement
    ->getUnit());
  $this
    ->assertEquals('10 m', $this->measurement
    ->__toString());
  $this
    ->assertEquals([
    'number' => '10',
    'unit' => 'm',
  ], $this->measurement
    ->toArray());
}