TestTrait.php
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2020 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of the MIT License.
7  *
8  * See the LICENSE file distributed with this work for
9  * additional information.
10  */
11 namespace wcmf\test\lib;
12 
16 
17 trait TestTrait {
18 
19  /**
20  * Get the logger for the given category
21  * @param $category
22  * @return Logger
23  */
24  protected function getLogger($category) {
25  return LogManager::getLogger($category);
26  }
27 
28  /**
29  * Replace backticks in the given sql string by the actual quote char
30  * used in the connection
31  * @param $sql
32  * @param $type The type defining the connection parameters
33  * @return String
34  */
35  protected function fixQueryQuotes($sql, $type) {
36  $persistenceFacade = ObjectFactory::getInstance('persistenceFacade');
37  $mapper = $persistenceFacade->getMapper($type);
38  return str_replace('`', $mapper->getQuoteIdentifierSymbol(), $sql);
39  }
40 }
41 ?>
Test support classes.
Definition: namespaces.php:100
Interface for logger implementations.
Definition: Logger.php:18
static getLogger($name)
Get the logger with the given name.
Definition: LogManager.php:37
static getInstance($name, $dynamicConfiguration=[])
LogManager is used to retrieve Logger instances.
Definition: LogManager.php:20
ObjectFactory implements the service locator pattern by wrapping a Factory instance and providing sta...