function PhpunitCompatibilityTraitTest::testAssertIs

Tests that assertIs(Not)* methods are available.

@covers ::assertIsArray
@covers ::assertIsBool
@covers ::assertIsFloat
@covers ::assertIsInt
@covers ::assertIsNumeric
@covers ::assertIsObject
@covers ::assertIsResource
@covers ::assertIsString
@covers ::assertIsScalar
@covers ::assertIsCallable
@covers ::assertIsNotArray
@covers ::assertIsNotBool
@covers ::assertIsNotFloat
@covers ::assertIsNotInt
@covers ::assertIsNotNumeric
@covers ::assertIsNotObject
@covers ::assertIsNotResource
@covers ::assertIsNotString
@covers ::assertIsNotScalar
@covers ::assertIsNotCallable

File

core/tests/Drupal/Tests/PhpunitCompatibilityTraitTest.php, line 96

Class

PhpunitCompatibilityTraitTest
Tests the PHPUnit forward compatibility trait.

Namespace

Drupal\Tests

Code

public function testAssertIs() {
  $this->assertIsArray([]);
  $this->assertIsBool(TRUE);
  $this->assertIsFloat(1.0);
  $this->assertIsInt(1);
  $this->assertIsNumeric(1);
  $this->assertIsObject(new class  {

});
  $this->assertIsResource(fopen(__FILE__, 'rb'));
  $this->assertIsString('');
  $this->assertIsScalar(1);
  $this->assertIsCallable(function () {
  });
  $this->assertIsNotArray(1);
  $this->assertIsNotBool([]);
  $this->assertIsNotFloat(1);
  $this->assertIsNotInt(1.0);
  $this->assertIsNotNumeric('');
  $this->assertIsNotObject('');
  $this->assertIsNotResource('');
  $this->assertIsNotString(1);
  $this->assertIsNotScalar([]);
  $this->assertIsNotCallable(1);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.