-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Turn off strict mode on import (#3784)
- Loading branch information
Showing
5 changed files
with
68 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,4 +38,4 @@ exclude_patterns: | |
- "**/*.module" | ||
- ".circleci/" | ||
- ".gitignore" | ||
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
modules/datastore/tests/src/Functional/Storage/DatabaseTableTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace Drupal\Tests\datastore\Functional\Storage; | ||
|
||
use Dkan\Datastore\Resource; | ||
use Drupal\datastore\Storage\DatabaseTable; | ||
use Drupal\Tests\common\Traits\CleanUp; | ||
use Drupal\Tests\common\Traits\GetDataTrait; | ||
use weitzman\DrupalTestTraits\ExistingSiteBase; | ||
|
||
/** | ||
* Test ResourcePurger service. | ||
* | ||
* @package Drupal\Tests\datastore\Functional | ||
* @group datastore | ||
*/ | ||
class DatabaseTableTest extends ExistingSiteBase { | ||
use GetDataTrait; | ||
use CleanUp; | ||
|
||
/** | ||
* Test that setInnodbMode() turns strict mode off for datastore. | ||
*/ | ||
public function testSetInnodbMode() { | ||
$connection = \Drupal::service('dkan.datastore.database'); | ||
$result = $connection->query("SHOW SESSION VARIABLES LIKE 'innodb_strict_mode'")->fetchObject(); | ||
$this->assertEquals($result->Value, "ON"); | ||
|
||
$resource = new Resource('123', '/tmp', 'text/csv'); | ||
|
||
$databaseTable = new DatabaseTable($connection, $resource); | ||
$databaseTable->innodbStrictMode(FALSE); | ||
|
||
$result = $connection->query("SHOW SESSION VARIABLES LIKE 'innodb_strict_mode'")->fetchObject(); | ||
$this->assertEquals($result->Value, "OFF"); | ||
|
||
// Other database connection not affected. | ||
$connection2 = \Drupal::service('database'); | ||
$result = $connection2->query("SHOW SESSION VARIABLES LIKE 'innodb_strict_mode'")->fetchObject(); | ||
$this->assertEquals($result->Value, "ON"); | ||
|
||
// Safe mode can be turned back on. | ||
$databaseTable->innodbStrictMode(TRUE); | ||
$result = $connection->query("SHOW SESSION VARIABLES LIKE 'innodb_strict_mode'")->fetchObject(); | ||
$this->assertEquals($result->Value, "ON"); | ||
} | ||
|
||
} |