You are here

public function CtoolsModuleTestCase::testApiVersionCompare in Chaos Tool Suite (ctools) 7

Test the ctools version compare function.

File

tests/ctools.test, line 133
Test classes for code in the CTools module file.

Class

CtoolsModuleTestCase
Test menu links depending on user permissions.

Code

public function testApiVersionCompare() {

  // We're beyond version 1.
  $ok = ctools_api_version('1.0');
  $this
    ->assertTrue($ok, 'Check API version 1.0 is ok');

  // We're beyond version 1.0.1 too.
  $ok = ctools_api_version('1.0.1');
  $this
    ->assertTrue($ok, 'Check API version 1.0.1 is ok');

  // Not (yet) on api version 10.
  $ok = ctools_api_version('10.0');
  $this
    ->assertFalse($ok, 'Check API version 10.0 is not ok');

  // We are (currently) between version 1.1 and version 4.0.
  $ok = ctools_api_version('1.1', '4.0');
  $this
    ->assertTrue($ok, 'Check API is between 1 and 4');
}