Completed
Push — 1.0-phpunit-6.5-once-again ( 2716a0 )
by Kamil
22:38
created

oauth_credentials_can_be_generated_randomly()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Sylius\Bundle\AdminApiBundle\Tests\Fixture;
15
16
use Doctrine\Common\Persistence\ObjectManager;
17
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait;
18
use PHPUnit\Framework\TestCase;
19
use Sylius\Bundle\AdminApiBundle\Fixture\ApiClientFixture;
20
use Sylius\Bundle\CoreBundle\Fixture\Factory\ExampleFactoryInterface;
21
22
final class ApiClientFixtureTest extends TestCase
23
{
24
    use ConfigurationTestCaseTrait;
25
26
    /**
27
     * @test
28
     */
29
    public function oauth_credentials_can_be_generated_randomly(): void
30
    {
31
        $this->assertConfigurationIsValid([['random' => 4]], 'random');
32
    }
33
34
    /**
35
     * @test
36
     */
37
    public function oauth_credentials_can_be_created_with_custom_random_id(): void
38
    {
39
        $this->assertConfigurationIsValid([['custom' => [[
40
            'random_id' => 'totally_random',
41
        ]]]], 'custom.*.random_id');
42
    }
43
44
    /**
45
     * @test
46
     */
47
    public function oauth_credentials_can_be_created_with_custom_secret(): void
48
    {
49
        $this->assertConfigurationIsValid([['custom' => [[
50
            'secret' => 'threeCanKeepSecretIfTwoAreDead',
51
        ]]]], 'custom.*.secret');
52
    }
53
54
    /**
55
     * @test
56
     */
57
    public function oauth_credentials_can_be_created_with_grant_type(): void
58
    {
59
        $this->assertConfigurationIsValid([['custom' => [[
60
            'allowed_grant_types' => [
61
                'password',
62
            ],
63
        ]]]], 'custom.*.allowed_grant_types');
64
    }
65
66
    /**
67
     * {@inheritdoc}
68
     */
69
    protected function getConfiguration(): ApiClientFixture
70
    {
71
        return new ApiClientFixture(
72
            $this->getMockBuilder(ObjectManager::class)->getMock(),
73
            $this->getMockBuilder(ExampleFactoryInterface::class)->getMock()
74
        );
75
    }
76
}
77