Convert property names to camel case in strings

[MAILPOET-1796]
This commit is contained in:
Jan Jakeš
2020-01-09 15:13:25 +01:00
committed by Jan Jakeš
parent 3bbc8ea2af
commit 7a66366ab5
4 changed files with 18 additions and 18 deletions

View File

@ -54,7 +54,7 @@ class ConnectionFactory {
'@@session.sql_mode = REPLACE(@@sql_mode, "ONLY_FULL_GROUP_BY", "")', '@@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` // 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 // 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)) { if (!empty(Env::$dbCharset)) {

View File

@ -33,9 +33,9 @@ class TimestampListenerTest extends \MailPoetTest {
$this->entityManager = $this->createEntityManager(); $this->entityManager = $this->createEntityManager();
$this->tableName = $this->entityManager->getClassMetadata(TimestampEntity::class)->getTableName(); $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(" $this->connection->executeUpdate("
CREATE TABLE $this->table_name ( CREATE TABLE $this->tableName (
id int(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, id int(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
created_at timestamp NULL, created_at timestamp NULL,
updated_at timestamp NULL, updated_at timestamp NULL,
@ -57,7 +57,7 @@ class TimestampListenerTest extends \MailPoetTest {
public function testItSetsTimestampOnUpdate() { public function testItSetsTimestampOnUpdate() {
$this->connection->executeUpdate(" $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, 123,
'2000-01-01 12:00:00', '2000-01-01 12:00:00',
'2000-01-01 12:00:00', '2000-01-01 12:00:00',
@ -75,7 +75,7 @@ class TimestampListenerTest extends \MailPoetTest {
public function _after() { public function _after() {
parent::_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() { private function createEntityManager() {

View File

@ -25,9 +25,9 @@ class ValidationTest extends \MailPoetTest {
$this->wp = new WPFunctions(); $this->wp = new WPFunctions();
$this->entityManager = $this->createEntityManager(); $this->entityManager = $this->createEntityManager();
$this->tableName = $this->entityManager->getClassMetadata(ValidatedEntity::class)->getTableName(); $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(" $this->connection->executeUpdate("
CREATE TABLE $this->table_name ( CREATE TABLE $this->tableName (
id int(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, id int(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
name varchar(255) NOT NULL name varchar(255) NOT NULL
) )
@ -49,7 +49,7 @@ class ValidationTest extends \MailPoetTest {
public function testItValidatesUpdatedEntity() { public function testItValidatesUpdatedEntity() {
$id = 1; $id = 1;
$name = 'Test name'; $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 */ /** @var ValidatedEntity $entity */
$entity = $this->entityManager->find(ValidatedEntity::class, $id); $entity = $this->entityManager->find(ValidatedEntity::class, $id);

View File

@ -37,9 +37,9 @@ class JsonTypesTest extends \MailPoetTest {
$this->wp = new WPFunctions(); $this->wp = new WPFunctions();
$this->entityManager = $this->createEntityManager(); $this->entityManager = $this->createEntityManager();
$this->tableName = $this->entityManager->getClassMetadata(JsonEntity::class)->getTableName(); $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(" $this->connection->executeUpdate("
CREATE TABLE $this->table_name ( CREATE TABLE $this->tableName (
id int(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, id int(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
json_data longtext NULL, json_data longtext NULL,
json_or_serialized_data longtext NULL json_or_serialized_data longtext NULL
@ -54,14 +54,14 @@ class JsonTypesTest extends \MailPoetTest {
$this->entityManager->persist($entity); $this->entityManager->persist($entity);
$this->entityManager->flush(); $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_data'])->same(json_encode($this->testData));
expect($savedData['json_or_serialized_data'])->same(json_encode($this->testData)); expect($savedData['json_or_serialized_data'])->same(json_encode($this->testData));
} }
public function testItLoadsJsonData() { public function testItLoadsJsonData() {
$this->connection->executeUpdate( $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, 1,
json_encode($this->testData), json_encode($this->testData),
@ -76,7 +76,7 @@ class JsonTypesTest extends \MailPoetTest {
public function testItLoadsSerializedData() { public function testItLoadsSerializedData() {
$this->connection->executeUpdate( $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, 1,
serialize($this->testData), serialize($this->testData),
@ -95,14 +95,14 @@ class JsonTypesTest extends \MailPoetTest {
$this->entityManager->persist($entity); $this->entityManager->persist($entity);
$this->entityManager->flush(); $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_data'])->null();
expect($savedData['json_or_serialized_data'])->null(); expect($savedData['json_or_serialized_data'])->null();
} }
public function testItLoadsNullData() { public function testItLoadsNullData() {
$this->connection->executeUpdate( $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, 1,
null, null,
@ -117,7 +117,7 @@ class JsonTypesTest extends \MailPoetTest {
public function testItLoadsEmptyStringAsNull() { public function testItLoadsEmptyStringAsNull() {
$this->connection->executeUpdate( $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, 1,
'', '',
@ -146,7 +146,7 @@ class JsonTypesTest extends \MailPoetTest {
public function testItDoesNotLoadInvalidData() { public function testItDoesNotLoadInvalidData() {
$this->connection->executeUpdate( $this->connection->executeUpdate(
"INSERT INTO $this->table_name (id, json_data) VALUES (?, ?)", "INSERT INTO $this->tableName (id, json_data) VALUES (?, ?)",
[ [
1, 1,
'{', // invalid JSON '{', // invalid JSON
@ -164,7 +164,7 @@ class JsonTypesTest extends \MailPoetTest {
public function _after() { public function _after() {
parent::_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() { private function createEntityManager() {