PaymentsServiceProviderTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 12
c 2
b 0
f 1
dl 0
loc 20
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testRegister() 0 18 1
1
<?php
2
3
namespace ByTIC\Payments\Tests;
4
5
use ByTIC\Payments\Models\Purchases\Purchases;
6
use ByTIC\Payments\PaymentsServiceProvider;
7
use Paytic\Payments\Tests\Fixtures\Records\Purchases\PurchasableRecordManager;
8
use Nip\Config\Config;
9
use Nip\Container\Container;
10
use Nip\Records\Locator\ModelLocator;
11
12
/**
13
 * Class PaymentsServiceProviderTest
14
 * @package ByTIC\Payments\Tests
15
 */
16
class PaymentsServiceProviderTest extends AbstractTestCase
17
{
18
    public function testRegister()
19
    {
20
        $container = Container::getInstance();
21
22
        $data = [
23
            'payments' => require PROJECT_BASE_PATH . '/config/payments.php'
24
        ];
25
        $config = new Config($data);
26
        $container->set('config', $config);
27
28
        ModelLocator::set(Purchases::class, new PurchasableRecordManager());
29
30
        $provider = new PaymentsServiceProvider();
31
        $provider->setContainer($container);
32
        $provider->register();
33
34
        $purchases = $provider->getContainer()->get('purchases');
35
        self::assertInstanceOf(PurchasableRecordManager::class, $purchases);
36
    }
37
}
38