You are here

class IntervalTest in Plug 7

Hierarchy

  • class \Symfony\Component\Translation\Tests\IntervalTest extends \Symfony\Component\Translation\Tests\PHPUnit_Framework_TestCase

Expanded class hierarchy of IntervalTest

File

lib/Symfony/translation/Tests/IntervalTest.php, line 16

Namespace

Symfony\Component\Translation\Tests
View source
class IntervalTest extends \PHPUnit_Framework_TestCase {

  /**
   * @dataProvider getTests
   */
  public function testTest($expected, $number, $interval) {
    $this
      ->assertEquals($expected, Interval::test($number, $interval));
  }

  /**
   * @expectedException \InvalidArgumentException
   */
  public function testTestException() {
    Interval::test(1, 'foobar');
  }
  public function getTests() {
    return array(
      array(
        true,
        3,
        '{1,2, 3 ,4}',
      ),
      array(
        false,
        10,
        '{1,2, 3 ,4}',
      ),
      array(
        false,
        3,
        '[1,2]',
      ),
      array(
        true,
        1,
        '[1,2]',
      ),
      array(
        true,
        2,
        '[1,2]',
      ),
      array(
        false,
        1,
        ']1,2[',
      ),
      array(
        false,
        2,
        ']1,2[',
      ),
      array(
        true,
        log(0),
        '[-Inf,2[',
      ),
      array(
        true,
        -log(0),
        '[-2,+Inf]',
      ),
    );
  }

}

Members

Namesort descending Modifiers Type Description Overrides
IntervalTest::getTests public function
IntervalTest::testTest public function @dataProvider getTests
IntervalTest::testTestException public function @expectedException \InvalidArgumentException