Skip to content

Commit

Permalink
fix constact synchronization bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaspijak committed Oct 11, 2023
1 parent 49bcede commit 114c8c6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Event/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function dispatch(string $category, string $endpoint, Variables $variable

private function check(string $category, string $endpoint, Variables $variables): bool
{
$variables['contact_synchronize'] = $this->settings->load('main:synchronize') ?? 'all';
$variables['contact_synchronize'] = $this->settings->load('main:synchronization') ?? 'all';
$variables['contact_address_preference'] = $this->settings->load('main:address_preference') ?? 'delivery';

if ($variables['contact_synchronize'] === 'all')
Expand Down
14 changes: 7 additions & 7 deletions tests/Event/DispatcherTest.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class DispatcherTest extends TestCase

$dispatcher = new Dispatcher($settings = Mockery::mock(Settings::class), Mockery::mock(Hook::class), $loader = Mockery::mock(Loader::class));
$loader->shouldReceive('load')->with($variables, [])->once();
$settings->shouldReceive('load')->with('main:synchronize')->once()->andReturn('all');
$settings->shouldReceive('load')->with('main:synchronization')->once()->andReturn('all');
$settings->shouldReceive('load')->with('main:address_preference')->once()->andReturn('invoice');
$settings->shouldReceive('load')->with('main:dispatcher')->once()->andReturn('cron');
$settings->shouldReceive('set')->with(Mockery::on(function (string $key): bool
Expand Down Expand Up @@ -53,7 +53,7 @@ class DispatcherTest extends TestCase

$dispatcher = new Dispatcher($settings = Mockery::mock(Settings::class), Mockery::mock(Hook::class), $loader = Mockery::mock(Loader::class));
$loader->shouldReceive('load')->with($variables, [])->once();
$settings->shouldReceive('load')->with('main:synchronize')->once()->andReturn('all');
$settings->shouldReceive('load')->with('main:synchronization')->once()->andReturn('all');
$settings->shouldReceive('load')->with('main:address_preference')->once()->andReturn('delivery');
$settings->shouldReceive('load')->with('main:dispatcher')->once()->andReturn('asset');
$settings->shouldReceive('set')->with(Mockery::on(function (string $key): bool
Expand All @@ -75,7 +75,7 @@ class DispatcherTest extends TestCase

$dispatcher = new Dispatcher($settings = Mockery::mock(Settings::class), $hook = Mockery::mock(Hook::class), $loader = Mockery::mock(Loader::class));
$loader->shouldReceive('load')->with($variables, [])->once();
$settings->shouldReceive('load')->with('main:synchronize')->once()->andReturn('all');
$settings->shouldReceive('load')->with('main:synchronization')->once()->andReturn('all');
$settings->shouldReceive('load')->with('main:address_preference')->once()->andReturnNull();
$settings->shouldReceive('load')->with('main:dispatcher')->once()->andReturn('direct');
$hook->shouldReceive('dispatch')->with('order', 'new', ['contact_synchronize' => 'all', 'contact_address_preference' => 'delivery'])->once();
Expand All @@ -92,7 +92,7 @@ class DispatcherTest extends TestCase

$dispatcher = new Dispatcher($settings = Mockery::mock(Settings::class), $hook = Mockery::mock(Hook::class), $loader = Mockery::mock(Loader::class));
$loader->shouldReceive('load')->with($variables, ['ok'])->once();
$settings->shouldReceive('load')->with('main:synchronize')->once()->andReturn('message');
$settings->shouldReceive('load')->with('main:synchronization')->once()->andReturn('message');
$settings->shouldReceive('load')->with('main:address_preference')->once()->andReturn('invoice');
$settings->shouldReceive('load')->with('main:dispatcher')->once()->andReturn('direct');
$settings->shouldReceive('load')->with('main:language_mutation')->once()->andReturn('1');
Expand All @@ -113,7 +113,7 @@ class DispatcherTest extends TestCase

$dispatcher = new Dispatcher($settings = Mockery::mock(Settings::class), $hook = Mockery::mock(Hook::class), $loader = Mockery::mock(Loader::class));
$loader->shouldReceive('load')->with($variables, [])->once();
$settings->shouldReceive('load')->with('main:synchronize')->once()->andReturn('off');
$settings->shouldReceive('load')->with('main:synchronization')->once()->andReturn('off');
$settings->shouldReceive('load')->with('main:address_preference')->once()->andReturnNull();
$settings->shouldReceive('load')->with('main:dispatcher')->once()->andReturn('direct');
$settings->shouldReceive('load')->with('main:language_mutation')->once()->andReturn('1');
Expand All @@ -135,7 +135,7 @@ class DispatcherTest extends TestCase

$dispatcher = new Dispatcher($settings = Mockery::mock(Settings::class), $hook = Mockery::mock(Hook::class), $loader = Mockery::mock(Loader::class));
$loader->shouldReceive('load')->with($variables, [])->once();
$settings->shouldReceive('load')->with('main:synchronize')->once()->andReturn('message');
$settings->shouldReceive('load')->with('main:synchronization')->once()->andReturn('message');
$settings->shouldReceive('load')->with('main:address_preference')->once()->andReturnNull();
$settings->shouldReceive('load')->with('main:dispatcher')->once()->andReturn('direct');
$settings->shouldReceive('load')->with('main:language_mutation')->once()->andReturnNull();
Expand All @@ -156,7 +156,7 @@ class DispatcherTest extends TestCase

$dispatcher = new Dispatcher($settings = Mockery::mock(Settings::class), Mockery::mock(Hook::class), $loader = Mockery::mock(Loader::class));
$loader->shouldReceive('load')->with($variables, [])->once();
$settings->shouldReceive('load')->with('main:synchronize')->once()->andReturn('specific');
$settings->shouldReceive('load')->with('main:synchronization')->once()->andReturn('specific');
$settings->shouldReceive('load')->with('main:address_preference')->once()->andReturnNull();
$settings->shouldReceive('load')->with('main:language_mutation')->once()->andReturnNull();
$settings->shouldReceive('load')->with('admin_sms-default-0:return_new')->once()->andReturnNull();
Expand Down
3 changes: 3 additions & 0 deletions tests/User/SignTest.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ use function json_encode;

require_once __DIR__ . '/../bootstrap.php';

/**
* @testCase
*/
class SignTest extends TestCase
{
public function testAuthenticate(): void
Expand Down

0 comments on commit 114c8c6

Please sign in to comment.