protected static function NodeCreationTest::getWatchdogIdsForTestExceptionRollback in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/node/src/Tests/NodeCreationTest.php \Drupal\node\Tests\NodeCreationTest::getWatchdogIdsForTestExceptionRollback()
Gets the watchdog IDs of the records with the rollback exception message.
Return value
int[] Array containing the IDs of the log records with the rollback exception message.
1 call to NodeCreationTest::getWatchdogIdsForTestExceptionRollback()
- NodeCreationTest::testFailedPageCreation in core/
modules/ node/ src/ Tests/ NodeCreationTest.php - Verifies that a transaction rolls back the failed creation.
File
- core/
modules/ node/ src/ Tests/ NodeCreationTest.php, line 199 - Contains \Drupal\node\Tests\NodeCreationTest.
Class
- NodeCreationTest
- Create a node and test saving it.
Namespace
Drupal\node\TestsCode
protected static function getWatchdogIdsForTestExceptionRollback() {
// PostgreSQL doesn't support bytea LIKE queries, so we need to unserialize
// first to check for the rollback exception message.
$matches = array();
$query = db_query("SELECT wid, variables FROM {watchdog}");
foreach ($query as $row) {
$variables = (array) unserialize($row->variables);
if (isset($variables['@message']) && $variables['@message'] === 'Test exception for rollback.') {
$matches[] = $row->wid;
}
}
return $matches;
}