Skip to content

Commit

Permalink
OXDEV-46 Clean up & small refactorings for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbbbauer committed Sep 28, 2017
1 parent f314120 commit 4f171ac
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions library/UnitTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use modOXID;
use modOxUtilsDate;

use oxDatabaseHelper;
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\EshopCommunity\Core\Database\Adapter\DatabaseInterface;
use OxidEsales\EshopCommunity\Core\Database;
Expand All @@ -38,6 +39,7 @@
use ReflectionClass;
use Exception;

require_once TEST_LIBRARY_HELPERS_PATH . 'oxDatabaseHelper.php';
require_once TEST_LIBRARY_HELPERS_PATH . 'modOxUtilsDate.php';

/**
Expand Down
16 changes: 15 additions & 1 deletion library/helpers/oxDatabaseHelper.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/**
* This file is part of OXID eSales Testing Library.
*
Expand Down Expand Up @@ -81,6 +80,21 @@ public function existsView($tableName)
return $tableNameView === $this->database->getOne($sql);
}

/**
* @param string $tableName The name of the table we want to assure to exist.
*
* @return bool Does the database table with the given name exists?
*/
public function existsTable($tableName)
{
$database = DatabaseProvider::getDb();
$sql = "SELECT COUNT(TABLE_NAME) FROM information_schema.TABLES WHERE TABLE_NAME = '$tableName'";

$count = $database->getOne($sql);

return $count > 0;
}

public function adjustTemplateBlocksOxModuleColumn()
{
$sql = "ALTER TABLE `oxtplblocks`
Expand Down

0 comments on commit 4f171ac

Please sign in to comment.