Skip to content

Commit

Permalink
Merge pull request #11 from stefk/master
Browse files Browse the repository at this point in the history
Fixes core init_test_schema command bug + deps
  • Loading branch information
ngodfraind committed Aug 19, 2015
2 parents 3551dff + 3a3a525 commit 039acb6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: php
php:
- 5.3
- 5.4
before_script: composer install --dev
- 5.5
- 5.6
before_script: composer self-update && composer install --dev
13 changes: 10 additions & 3 deletions Manager/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

namespace Claroline\MigrationBundle\Manager;

use Claroline\BundleRecorder\Log\LoggableTrait;
use Psr\Log\LoggerAwareTrait;
use Psr\Log\LogLevel;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Claroline\MigrationBundle\Generator\Generator;
use Claroline\MigrationBundle\Generator\Writer;
Expand All @@ -22,12 +23,11 @@
*/
class Manager
{
use LoggableTrait;
use LoggerAwareTrait;

private $generator;
private $writer;
private $migrator;
private $supportedPlatforms;

/**
* Constructor.
Expand Down Expand Up @@ -177,4 +177,11 @@ private function doMigrate(Bundle $bundle, $version, $direction)
"Done: bundle is now at version {$currentVersion}"
);
}

private function log($message)
{
if ($this->logger) {
$this->logger->log(LogLevel::INFO, $message);
}
}
}
6 changes: 5 additions & 1 deletion Migrator/Migrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ private function getConfiguration(Bundle $bundle)
}

$driverName = $this->connection->getDriver()->getName();

$migrationsDir = "{$bundle->getPath()}/Migrations/{$driverName}";
$migrationsName = "{$bundle->getName()} migration";
$migrationsNamespace = "{$bundle->getNamespace()}\\Migrations\\{$driverName}";
Expand All @@ -145,7 +146,10 @@ private function getConfiguration(Bundle $bundle)
$config->setMigrationsDirectory($migrationsDir);
$config->setMigrationsNamespace($migrationsNamespace);
$config->setMigrationsTableName($migrationsTableName);
$config->registerMigrationsFromDirectory($migrationsDir);

if (is_dir($migrationsDir)) {
$config->registerMigrationsFromDirectory($migrationsDir);
}

$this->cacheConfigs[$bundle->getName()] = $config;

Expand Down
1 change: 0 additions & 1 deletion Tests/Manager/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public function testGenerateBundleMigration(array $queries, $areQueriesEmpty)
public function testGetAvailablePlatforms()
{
$platforms = $this->manager->getAvailablePlatforms();
$this->assertGreaterThan(1, count($platforms));
$this->assertContains('pdo_mysql', array_keys($platforms));
$this->assertInstanceOf('Doctrine\DBAL\Platforms\AbstractPlatform', $platforms['pdo_mysql']);
}
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
}
],
"require": {
"php": ">=5.3.3",
"php": ">=5.4.1",
"symfony/framework-bundle": "*",
"symfony/console": "~2.0",
"symfony/twig-bridge": "~2.0",
"symfony/twig-bundle": "~2.0",
"doctrine/orm": "~2.2",
"doctrine/migrations": "dev-master",
"jdorn/sql-formatter": "~1.0",
"psr/log": "~1.0",
"claroline/kernel-bundle": "~6.0"
},
"require-dev": {
Expand Down

0 comments on commit 039acb6

Please sign in to comment.