Skip to content

Commit

Permalink
Fix test cms install
Browse files Browse the repository at this point in the history
  • Loading branch information
duyphan2502 committed May 18, 2017
1 parent 1bf812f commit c2d8a2b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SESSION_DRIVER=file
QUEUE_DRIVER=sync

CACHE_DRIVER=file
CACHE_REPOSITORY=true
CACHE_REPOSITORY=false
CACHE_REPOSITORY_LIFETIME=-1

REDIS_HOST=127.0.0.1
Expand Down
31 changes: 28 additions & 3 deletions tests/CmsInstallTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

use WebEd\Base\ModulesManagement\Repositories\CoreModulesRepository;
use WebEd\Base\ModulesManagement\Repositories\Contracts\CoreModulesRepositoryContract;

class CmsInstallTest extends Tests\TestCase
{
/**
Expand All @@ -12,12 +15,18 @@ class CmsInstallTest extends Tests\TestCase
*/
protected $userRepository;

/**
* @var CoreModulesRepository
*/
protected $coreModuleRepository;

protected function setUp()
{
parent::setUp(); // TODO: Change the autogenerated stub

$this->roleRepository = app(\WebEd\Base\ACL\Repositories\Contracts\RoleRepositoryContract::class);
$this->userRepository = app(\WebEd\Base\Users\Repositories\Contracts\UserRepositoryContract::class);
$this->coreModuleRepository = app(CoreModulesRepositoryContract::class);
}

/**
Expand Down Expand Up @@ -65,15 +74,31 @@ protected function createAdminUser()

protected function registerInstallModuleService()
{
$modules = get_modules_by_type('base');
$modules = get_core_module();

$core = $modules->where('alias', '=', 'webed-core')->first();

$coreNamespace = str_replace('\\\\', '\\', array_get($core, 'namespace', '') . '\Providers\InstallModuleServiceProvider');

$this->app->register($coreNamespace);

$data = [
'alias' => 'webed-core',
'installed_version' => get_cms_version(),
];
$this->coreModuleRepository->create($data);

$modules = get_core_module()->where('namespace', '!=', 'WebEd\Base');

foreach ($modules as $module) {
$namespace = str_replace('\\\\', '\\', array_get($module, 'namespace', '') . '\Providers\InstallModuleServiceProvider');
if (class_exists($namespace)) {
$this->app->register($namespace);
}
}
\Artisan::call('vendor:publish', [
/*\Artisan::call('vendor:publish', [
'--tag' => 'webed-public-assets',
]);
'--force' => true,
]);*/
}
}

0 comments on commit c2d8a2b

Please sign in to comment.