You are here

class MathTest in Realistic Dummy Content 8.2

Same name and namespace in other branches
  1. 7.2 api/src/test/includes/MathTest.php \Drupal\realistic_dummy_content_api\Test\MathTest

Tests for \Drupal\realistic_dummy_content_api\includes\Math.

@group realistic_dummy_content

Hierarchy

  • class \Drupal\realistic_dummy_content_api\Test\MathTest extends \Drupal\realistic_dummy_content_api\Test\PHPUnit_Framework_TestCase

Expanded class hierarchy of MathTest

File

api/src/test/includes/MathTest.php, line 14

Namespace

Drupal\realistic_dummy_content_api\Test
View source
class MathTest extends \PHPUnit_Framework_TestCase {

  /**
   * Tests Math::sequential().
   *
   * @param int $start
   *   Start number passed to realistic_dummy_content_api_sequential().
   * @param int $end
   *   End number passed to realistic_dummy_content_api_sequential().
   * @param string $hash
   *   Hash passed to realistic_dummy_content_api_sequential().
   * @param int $expected
   *   Expected result which realistic_dummy_content_api_sequential() is
   *   expected to return.
   *
   * @dataProvider providerTestSequential
   */
  public function testSequential($start, $end, $hash, $expected) {
    $math = new Math();
    $result = $math
      ->sequential($start, $end, $hash);
    $this
      ->assertTrue($result == $expected, 'Sequential number is as expected for ' . $start . ', ' . $end . ' with hash ' . $hash . ': [expected] ' . $expected . ' = [result] ' . $result);
  }

  /**
   * Data provider for $this->testSequential().
   */
  public function providerTestSequential() {
    return array(
      array(
        0,
        3,
        'a',
        0,
      ),
      array(
        0,
        3,
        'a',
        0,
      ),
      array(
        0,
        3,
        'b',
        1,
      ),
      array(
        0,
        3,
        'b',
        1,
      ),
      array(
        0,
        3,
        'c',
        2,
      ),
      array(
        0,
        3,
        'c',
        2,
      ),
      array(
        0,
        3,
        'd',
        3,
      ),
      array(
        0,
        2,
        'd',
        2,
      ),
      array(
        10,
        13,
        'd',
        10,
      ),
      array(
        11,
        12,
        'd',
        11,
      ),
    );
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MathTest::providerTestSequential public function Data provider for $this->testSequential().
MathTest::testSequential public function Tests Math::sequential().