Skip to content

Commit

Permalink
fix bugs and test
Browse files Browse the repository at this point in the history
  • Loading branch information
makasim committed Jun 10, 2019
1 parent 1e97bb1 commit 7e1072c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 24 deletions.
36 changes: 19 additions & 17 deletions Tests/DI/QuartzConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,26 @@ public function testShouldImplementConfigurationInterface()

public function testShouldReturnDefaultConfig()
{
$configuration = new QuartzConfiguration([]);
$configuration = new QuartzConfiguration();

$processor = new Processor();
$config = $processor->processConfiguration($configuration, [[]]);
$config = $processor->processConfiguration($configuration, [[
'yadm_simple_store' => [],
]]);

$expectedConfig = [
'store' => [
'yadm_simple_store' => [
'uri' => 'mongodb://localhost:27017',
'uriOptions' => [],
'driverOptions' => [],
'sessionId' => 'quartz',
'dbName' => null,
'managementLockCol' => 'managementLock',
'calendarCol' => 'calendar',
'triggerCol' => 'trigger',
'firedTriggerCol' => 'firedTrigger',
'jobCol' => 'job',
'pausedTriggerCol' => 'pausedTrigger',
'managementLockCol' => 'quartz_management_lock',
'calendarCol' => 'quartz_calendar',
'triggerCol' => 'quartz_trigger',
'firedTriggerCol' => 'quartz_fired_trigger',
'jobCol' => 'quartz_job',
'pausedTriggerCol' => 'quartz_paused_trigger',
],
'misfireThreshold' => 60,
];
Expand All @@ -46,25 +48,25 @@ public function testCouldSetConfigurationOptions()

$processor = new Processor();
$config = $processor->processConfiguration($configuration, [[
'store' => [
'yadm_simple_store' => [
'uri' => 'the-uri',
],
'misfireThreshold' => 120,
]]);

$expectedConfig = [
'store' => [
'yadm_simple_store' => [
'uri' => 'the-uri',
'uriOptions' => [],
'driverOptions' => [],
'sessionId' => 'quartz',
'dbName' => null,
'managementLockCol' => 'managementLock',
'calendarCol' => 'calendar',
'triggerCol' => 'trigger',
'firedTriggerCol' => 'firedTrigger',
'jobCol' => 'job',
'pausedTriggerCol' => 'pausedTrigger',
'managementLockCol' => 'quartz_management_lock',
'calendarCol' => 'quartz_calendar',
'triggerCol' => 'quartz_trigger',
'firedTriggerCol' => 'quartz_fired_trigger',
'jobCol' => 'quartz_job',
'pausedTriggerCol' => 'quartz_paused_trigger',
],
'misfireThreshold' => 120,
];
Expand Down
8 changes: 1 addition & 7 deletions Tests/Yadm/YadmStoreTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php
namespace Quartz\Bridge\Tests\Yadm;

use function Formapro\Values\register_cast_hooks;
use Quartz\Calendar\HolidayCalendar;
use Quartz\Core\CompletedExecutionInstruction;
use Quartz\Core\JobPersistenceException;
Expand All @@ -27,17 +26,12 @@ class YadmStoreTest extends \PHPUnit_Framework_TestCase
*/
private $res;

public static function setUpBeforeClass()
{
register_cast_hooks();
}

protected function setUp()
{
parent::setUp();

$config = [
'uri' => sprintf('mongodb://%s:%s', getenv('MONGODB_HOST'), getenv('MONGODB_PORT')),
'uri' => sprintf('mongodb://%s:%s/quartz_test', getenv('MONGODB_HOST'), getenv('MONGODB_PORT')),
'dbName' => getenv('MONGODB_DB')
];

Expand Down

0 comments on commit 7e1072c

Please sign in to comment.