-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathBe2BillDirectGatewayFactoryTest.php
82 lines (61 loc) · 2.29 KB
/
Be2BillDirectGatewayFactoryTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
namespace Payum\Be2Bill\Tests;
use Payum\Be2Bill\Be2BillDirectGatewayFactory;
use Payum\Core\Exception\LogicException;
use Payum\Core\Tests\AbstractGatewayFactoryTest;
class Be2BillDirectGatewayFactoryTest extends AbstractGatewayFactoryTest
{
public function testShouldAddDefaultConfigPassedInConstructorWhileCreatingGatewayConfig(): void
{
$factory = new Be2BillDirectGatewayFactory([
'foo' => 'fooVal',
'bar' => 'barVal',
]);
$config = $factory->createConfig();
$this->assertIsArray($config);
$this->assertArrayHasKey('foo', $config);
$this->assertSame('fooVal', $config['foo']);
$this->assertArrayHasKey('bar', $config);
$this->assertSame('barVal', $config['bar']);
}
public function testShouldConfigContainDefaultOptions(): void
{
$factory = new Be2BillDirectGatewayFactory();
$config = $factory->createConfig();
$this->assertIsArray($config);
$this->assertArrayHasKey('payum.default_options', $config);
$this->assertEquals([
'identifier' => '',
'password' => '',
'sandbox' => true,
], $config['payum.default_options']);
}
public function testShouldConfigContainFactoryNameAndTitle(): void
{
$factory = new Be2BillDirectGatewayFactory();
$config = $factory->createConfig();
$this->assertIsArray($config);
$this->assertArrayHasKey('payum.factory_name', $config);
$this->assertSame('be2bill_direct', $config['payum.factory_name']);
$this->assertArrayHasKey('payum.factory_title', $config);
$this->assertSame('Be2Bill Direct', $config['payum.factory_title']);
}
public function testShouldThrowIfRequiredOptionsNotPassed(): void
{
$this->expectException(LogicException::class);
$this->expectExceptionMessage('The identifier, password fields are required.');
$factory = new Be2BillDirectGatewayFactory();
$factory->create();
}
protected function getGatewayFactoryClass(): string
{
return Be2BillDirectGatewayFactory::class;
}
protected function getRequiredOptions(): array
{
return [
'identifier' => 'anId',
'password' => 'aPass',
];
}
}