BaseTestCase.php
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2015 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 /**
18  * BaseTestCase is the base class for all wCMF test cases.
19  *
20  * @author ingo herwig <ingo@wemove.com>
21  */
22 abstract class BaseTestCase extends \PHPUnit_Framework_TestCase {
23 
24  protected function setUp() {
25  TestUtil::initFramework(WCMF_BASE.'app/config/');
26  parent::setUp();
27  $logger = LogManager::getLogger(__CLASS__);
28  $logger->info("Running: ".get_class($this).".".$this->getName());
29  }
30 
31  /**
32  * Replace backticks in the given sql string by the actual quote char
33  * used in the connection
34  * @param $sql
35  * @param $type The type defining the connection parameters
36  * @return String
37  */
38  protected function fixQueryQuotes($sql, $type) {
39  $persistenceFacade = ObjectFactory::getInstance('persistenceFacade');
40  $connection = $persistenceFacade->getMapper($type)->getConnection();
41  return str_replace('`', $connection->getQuoteIdentifierSymbol(), $sql);
42  }
43 }
44 ?>
fixQueryQuotes($sql, $type)
Replace backticks in the given sql string by the actual quote char used in the connection.
static getLogger($name)
Get the logger with the given name.
Definition: LogManager.php:35
static getInstance($name, $dynamicConfiguration=array())
Test support classes.
Definition: namespaces.php:100
static initFramework($configPath)
Set up the wcmf framework.
Definition: TestUtil.php:36
BaseTestCase is the base class for all wCMF test cases.