Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip tests requiring MySQL if MySQL is not available #970

Merged
merged 1 commit into from Aug 1, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions unit-tests/CacheResultsetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ protected function _getCache($adapter='File'){

public function testCacheResultsetNormal()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

$cache = $this->_getCache();

Expand All @@ -118,6 +123,11 @@ public function testCacheResultsetNormal()

public function testCacheResultsetBinding()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

$cache = $this->_getCache();

Expand All @@ -142,6 +152,11 @@ public function testCacheResultsetBinding()

public function testCacheResultsetSimple()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

$cache = $this->_getCache();

Expand All @@ -163,6 +178,11 @@ public function testCacheResultsetSimple()

public function testCacheResultsetSimpleNoComplete()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

$cache = $this->_getCache();

Expand All @@ -184,6 +204,11 @@ public function testCacheResultsetSimpleNoComplete()

public function testCacheResultsetSimpleNoComplex()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

$cache = $this->_getCache();

Expand All @@ -205,6 +230,12 @@ public function testCacheResultsetSimpleNoComplex()

public function testCacheResultsetSimpleMemcached()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

if (!class_exists('Memcache')) {
$this->markTestSkipped("Memcache class does not exist, test skipped");
return;
Expand Down Expand Up @@ -286,6 +317,12 @@ public function testCacheResultsetSimpleMemcached()

public function testCacheResultsetSimpleLibmemcached()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

if (!class_exists('Memcached')) {
$this->markTestSkipped("Memcached class does not exist, test skipped");
return;
Expand Down
12 changes: 11 additions & 1 deletion unit-tests/ModelsBehaviorsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ protected function _prepareDI()

public function testBehaviorsTimestampable()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped("Test skipped");
return;
}

$this->_prepareDI();

Expand All @@ -74,6 +79,11 @@ public function testBehaviorsTimestampable()

public function testBehaviorsSoftDelete()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped("Test skipped");
return;
}

$this->_prepareDI();

Expand All @@ -85,4 +95,4 @@ public function testBehaviorsSoftDelete()
$this->assertEquals(News\Subscribers::count(), $number);
}

}
}
5 changes: 5 additions & 0 deletions unit-tests/ModelsDynamicOperationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ protected function _getDI()

public function testModelsMysql()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

$di = $this->_getDI();

Expand Down
15 changes: 15 additions & 0 deletions unit-tests/ModelsEventsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ protected function _prepareDI(&$trace)

public function testEventsCreate()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

$trace = array();

Expand Down Expand Up @@ -118,6 +123,11 @@ public function testEventsCreate()

public function testEventsUpdate()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

$trace = array();

Expand Down Expand Up @@ -163,6 +173,11 @@ public function testEventsUpdate()

public function testEventsDelete()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

$trace = array();

Expand Down
5 changes: 5 additions & 0 deletions unit-tests/ModelsFindersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ protected function _getDI()

public function testModels()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

$di = $this->_getDI();

Expand Down
5 changes: 5 additions & 0 deletions unit-tests/ModelsMassAssigmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ protected function _getDI()

public function testModels()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

$di = $this->_getDI();

Expand Down
27 changes: 26 additions & 1 deletion unit-tests/ModelsMetadataAdaptersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ protected function _getDI()

public function testMetadataMemory()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

$di = $this->_getDI();

Expand All @@ -132,9 +137,14 @@ public function testMetadataMemory()

public function testMetadataSession()
{

@session_start();

require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

$di = $this->_getDI();

$di->set('modelsMetadata', function(){
Expand Down Expand Up @@ -165,6 +175,11 @@ public function testMetadataSession()

public function testMetadataApc()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

if (!function_exists('apc_fetch')) {
$this->markTestSkipped('apc extension is not loaded');
Expand Down Expand Up @@ -201,6 +216,11 @@ public function testMetadataApc()

public function testMetadataXcache()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

if (!function_exists('xcache_get')) {
$this->markTestSkipped('xcache extension is not loaded');
Expand Down Expand Up @@ -237,6 +257,11 @@ public function testMetadataXcache()

public function testMetadataFiles()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

$di = $this->_getDI();

Expand Down
10 changes: 10 additions & 0 deletions unit-tests/ModelsMetadataStrategyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ protected function _getDI()

public function testMetadataDatabaseIntrospection()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

$di = $this->_getDI();

Expand All @@ -128,6 +133,11 @@ public function testMetadataDatabaseIntrospection()

public function testMetadataAnnotations()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

$di = $this->_getDI();

Expand Down
12 changes: 11 additions & 1 deletion unit-tests/ModelsMultipleSourcesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ protected function _prepareDI()

public function testSourcesStatic()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->marktestSkipped('Test skipped');
return;
}

$this->_prepareDI();

Expand All @@ -89,11 +94,16 @@ public function testSourcesStatic()

public function testSourcesInstance()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->marktestSkipped('Test skipped');
return;
}

$this->_prepareDI();

$robot = new Store\Robots();
$this->assertFalse($robot->save());
}

}
}
10 changes: 10 additions & 0 deletions unit-tests/ModelsQueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ protected function _getDI()

public function testAction()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped("Test skipped");
return;
}

$di = $this->_getDI();

Expand Down Expand Up @@ -261,6 +266,11 @@ public function testAction()

public function testIssue701()
{
if (empty($configMysql)) {
$this->markTestSkipped("Test skipped");
return;
}

$di = $this->_getDI();

$builder = new Builder();
Expand Down
21 changes: 20 additions & 1 deletion unit-tests/ModelsQueryParsingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ protected function _getDI()

public function testSelectParsing()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

$di = $this->_getDI();

Expand Down Expand Up @@ -6740,6 +6745,11 @@ public function testSelectParsing()

public function testInsertParsing()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

$di = $this->_getDI();

Expand Down Expand Up @@ -7100,6 +7110,11 @@ public function testInsertParsing()

public function testUpdateParsing()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

$di = $this->_getDI();

Expand Down Expand Up @@ -7692,10 +7707,14 @@ public function testUpdateParsing()

public function testDeleteParsing()
{
require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

$di = $this->_getDI();


$expected = array(
'tables' => array(
'robots',
Expand Down
5 changes: 5 additions & 0 deletions unit-tests/ModelsRelationsMagicTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public function testModelsMysql()
$di = $this->_getDI();

require 'unit-tests/config.db.php';
if (empty($configMysql)) {
$this->markTestSkipped('Test skipped');
return;
}

$connection = new Phalcon\Db\Adapter\Pdo\Mysql($configMysql);

$di->set('db', $connection);
Expand Down
Loading