NextIdTest.php in Zircon Profile 8.0
Same filename and directory in other branches
Contains \Drupal\system\Tests\Database\NextIdTest.
Namespace
Drupal\system\Tests\DatabaseFile
core/modules/system/src/Tests/Database/NextIdTest.phpView source
<?php
/**
* @file
* Contains \Drupal\system\Tests\Database\NextIdTest.
*/
namespace Drupal\system\Tests\Database;
use Drupal\simpletest\KernelTestBase;
/**
* Tests the sequences API.
*
* @group Database
*/
class NextIdTest extends KernelTestBase {
/**
* The modules to enable.
* @var array
*/
public static $modules = array(
'system',
);
protected function setUp() {
parent::setUp();
$this
->installSchema('system', 'sequences');
}
/**
* Tests that the sequences API works.
*/
function testDbNextId() {
$first = db_next_id();
$second = db_next_id();
// We can test for exact increase in here because we know there is no
// other process operating on these tables -- normally we could only
// expect $second > $first.
$this
->assertEqual($first + 1, $second, 'The second call from a sequence provides a number increased by one.');
$result = db_next_id(1000);
$this
->assertEqual($result, 1001, 'Sequence provides a larger number than the existing ID.');
}
}
Classes
Name | Description |
---|---|
NextIdTest | Tests the sequences API. |