Convert property names to camel case in strings
[MAILPOET-1796]
This commit is contained in:
@ -54,7 +54,7 @@ class ConnectionFactory {
|
||||
'@@session.sql_mode = REPLACE(@@sql_mode, "ONLY_FULL_GROUP_BY", "")',
|
||||
// We need to use CONVERT for MySQL 8, Maria DB bug which triggers #1232 - Incorrect argument type to variable 'wait_timeout`
|
||||
// https://stackoverflow.com/questions/35187378/mariadb-type-error-when-setting-session-variable
|
||||
"@@session.wait_timeout = GREATEST(CONVERT(COALESCE(@@wait_timeout, 0), SIGNED), $this->min_wait_timeout)",
|
||||
"@@session.wait_timeout = GREATEST(CONVERT(COALESCE(@@wait_timeout, 0), SIGNED), $this->minWaitTimeout)",
|
||||
];
|
||||
|
||||
if (!empty(Env::$dbCharset)) {
|
||||
|
@ -33,9 +33,9 @@ class TimestampListenerTest extends \MailPoetTest {
|
||||
|
||||
$this->entityManager = $this->createEntityManager();
|
||||
$this->tableName = $this->entityManager->getClassMetadata(TimestampEntity::class)->getTableName();
|
||||
$this->connection->executeUpdate("DROP TABLE IF EXISTS $this->table_name");
|
||||
$this->connection->executeUpdate("DROP TABLE IF EXISTS $this->tableName");
|
||||
$this->connection->executeUpdate("
|
||||
CREATE TABLE $this->table_name (
|
||||
CREATE TABLE $this->tableName (
|
||||
id int(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
created_at timestamp NULL,
|
||||
updated_at timestamp NULL,
|
||||
@ -57,7 +57,7 @@ class TimestampListenerTest extends \MailPoetTest {
|
||||
|
||||
public function testItSetsTimestampOnUpdate() {
|
||||
$this->connection->executeUpdate("
|
||||
INSERT INTO $this->table_name (id, created_at, updated_at, name) VALUES (
|
||||
INSERT INTO $this->tableName (id, created_at, updated_at, name) VALUES (
|
||||
123,
|
||||
'2000-01-01 12:00:00',
|
||||
'2000-01-01 12:00:00',
|
||||
@ -75,7 +75,7 @@ class TimestampListenerTest extends \MailPoetTest {
|
||||
|
||||
public function _after() {
|
||||
parent::_after();
|
||||
$this->connection->executeUpdate("DROP TABLE IF EXISTS $this->table_name");
|
||||
$this->connection->executeUpdate("DROP TABLE IF EXISTS $this->tableName");
|
||||
}
|
||||
|
||||
private function createEntityManager() {
|
||||
|
@ -25,9 +25,9 @@ class ValidationTest extends \MailPoetTest {
|
||||
$this->wp = new WPFunctions();
|
||||
$this->entityManager = $this->createEntityManager();
|
||||
$this->tableName = $this->entityManager->getClassMetadata(ValidatedEntity::class)->getTableName();
|
||||
$this->connection->executeUpdate("DROP TABLE IF EXISTS $this->table_name");
|
||||
$this->connection->executeUpdate("DROP TABLE IF EXISTS $this->tableName");
|
||||
$this->connection->executeUpdate("
|
||||
CREATE TABLE $this->table_name (
|
||||
CREATE TABLE $this->tableName (
|
||||
id int(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
name varchar(255) NOT NULL
|
||||
)
|
||||
@ -49,7 +49,7 @@ class ValidationTest extends \MailPoetTest {
|
||||
public function testItValidatesUpdatedEntity() {
|
||||
$id = 1;
|
||||
$name = 'Test name';
|
||||
$this->connection->executeUpdate("INSERT INTO $this->table_name (id, name) VALUES (?, ?)", [$id, $name]);
|
||||
$this->connection->executeUpdate("INSERT INTO $this->tableName (id, name) VALUES (?, ?)", [$id, $name]);
|
||||
|
||||
/** @var ValidatedEntity $entity */
|
||||
$entity = $this->entityManager->find(ValidatedEntity::class, $id);
|
||||
|
@ -37,9 +37,9 @@ class JsonTypesTest extends \MailPoetTest {
|
||||
$this->wp = new WPFunctions();
|
||||
$this->entityManager = $this->createEntityManager();
|
||||
$this->tableName = $this->entityManager->getClassMetadata(JsonEntity::class)->getTableName();
|
||||
$this->connection->executeUpdate("DROP TABLE IF EXISTS $this->table_name");
|
||||
$this->connection->executeUpdate("DROP TABLE IF EXISTS $this->tableName");
|
||||
$this->connection->executeUpdate("
|
||||
CREATE TABLE $this->table_name (
|
||||
CREATE TABLE $this->tableName (
|
||||
id int(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
json_data longtext NULL,
|
||||
json_or_serialized_data longtext NULL
|
||||
@ -54,14 +54,14 @@ class JsonTypesTest extends \MailPoetTest {
|
||||
$this->entityManager->persist($entity);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$savedData = $this->connection->executeQuery("SELECT * FROM $this->table_name")->fetch();
|
||||
$savedData = $this->connection->executeQuery("SELECT * FROM $this->tableName")->fetch();
|
||||
expect($savedData['json_data'])->same(json_encode($this->testData));
|
||||
expect($savedData['json_or_serialized_data'])->same(json_encode($this->testData));
|
||||
}
|
||||
|
||||
public function testItLoadsJsonData() {
|
||||
$this->connection->executeUpdate(
|
||||
"INSERT INTO $this->table_name (id, json_data, json_or_serialized_data) VALUES (?, ?, ?)",
|
||||
"INSERT INTO $this->tableName (id, json_data, json_or_serialized_data) VALUES (?, ?, ?)",
|
||||
[
|
||||
1,
|
||||
json_encode($this->testData),
|
||||
@ -76,7 +76,7 @@ class JsonTypesTest extends \MailPoetTest {
|
||||
|
||||
public function testItLoadsSerializedData() {
|
||||
$this->connection->executeUpdate(
|
||||
"INSERT INTO $this->table_name (id, json_or_serialized_data) VALUES (?, ?)",
|
||||
"INSERT INTO $this->tableName (id, json_or_serialized_data) VALUES (?, ?)",
|
||||
[
|
||||
1,
|
||||
serialize($this->testData),
|
||||
@ -95,14 +95,14 @@ class JsonTypesTest extends \MailPoetTest {
|
||||
$this->entityManager->persist($entity);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$savedData = $this->connection->executeQuery("SELECT * FROM $this->table_name")->fetch();
|
||||
$savedData = $this->connection->executeQuery("SELECT * FROM $this->tableName")->fetch();
|
||||
expect($savedData['json_data'])->null();
|
||||
expect($savedData['json_or_serialized_data'])->null();
|
||||
}
|
||||
|
||||
public function testItLoadsNullData() {
|
||||
$this->connection->executeUpdate(
|
||||
"INSERT INTO $this->table_name (id, json_data, json_or_serialized_data) VALUES (?, ?, ?)",
|
||||
"INSERT INTO $this->tableName (id, json_data, json_or_serialized_data) VALUES (?, ?, ?)",
|
||||
[
|
||||
1,
|
||||
null,
|
||||
@ -117,7 +117,7 @@ class JsonTypesTest extends \MailPoetTest {
|
||||
|
||||
public function testItLoadsEmptyStringAsNull() {
|
||||
$this->connection->executeUpdate(
|
||||
"INSERT INTO $this->table_name (id, json_data, json_or_serialized_data) VALUES (?, ?, ?)",
|
||||
"INSERT INTO $this->tableName (id, json_data, json_or_serialized_data) VALUES (?, ?, ?)",
|
||||
[
|
||||
1,
|
||||
'',
|
||||
@ -146,7 +146,7 @@ class JsonTypesTest extends \MailPoetTest {
|
||||
|
||||
public function testItDoesNotLoadInvalidData() {
|
||||
$this->connection->executeUpdate(
|
||||
"INSERT INTO $this->table_name (id, json_data) VALUES (?, ?)",
|
||||
"INSERT INTO $this->tableName (id, json_data) VALUES (?, ?)",
|
||||
[
|
||||
1,
|
||||
'{', // invalid JSON
|
||||
@ -164,7 +164,7 @@ class JsonTypesTest extends \MailPoetTest {
|
||||
|
||||
public function _after() {
|
||||
parent::_after();
|
||||
$this->connection->executeUpdate("DROP TABLE IF EXISTS $this->table_name");
|
||||
$this->connection->executeUpdate("DROP TABLE IF EXISTS $this->tableName");
|
||||
}
|
||||
|
||||
private function createEntityManager() {
|
||||
|
Reference in New Issue
Block a user