Completed
Push — 1.0-sudo-false ( 910319 )
by Kamil
85:06 queued 20:14
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 Sylius\Bundle\AdminApiBundle\Fixture\ApiClientFixture;
19
use Sylius\Bundle\CoreBundle\Fixture\Factory\ExampleFactoryInterface;
20
21
class OAuthCredentialsFixtureTest extends \PHPUnit_Framework_TestCase
22
{
23
    use ConfigurationTestCaseTrait;
24
25
    /**
26
     * @test
27
     */
28
    public function oauth_credentials_can_be_generated_randomly(): void
29
    {
30
        $this->assertConfigurationIsValid([['random' => 4]], 'random');
31
    }
32
33
    /**
34
     * @test
35
     */
36
    public function oauth_credentials_can_be_created_with_custom_random_id(): void
37
    {
38
        $this->assertConfigurationIsValid([['custom' => [[
39
            'random_id' => 'totally_random',
40
        ]]]], 'custom.*.random_id');
41
    }
42
43
    /**
44
     * @test
45
     */
46
    public function oauth_credentials_can_be_created_with_custom_secret(): void
47
    {
48
        $this->assertConfigurationIsValid([['custom' => [[
49
            'secret' => 'threeCanKeepSecretIfTwoAreDead',
50
        ]]]], 'custom.*.secret');
51
    }
52
53
    /**
54
     * @test
55
     */
56
    public function oauth_credentials_can_be_created_with_grant_type(): void
57
    {
58
        $this->assertConfigurationIsValid([['custom' => [[
59
            'allowed_grant_types' => [
60
                'password',
61
            ],
62
        ]]]], 'custom.*.allowed_grant_types');
63
    }
64
65
    /**
66
     * {@inheritdoc}
67
     */
68
    protected function getConfiguration(): ApiClientFixture
69
    {
70
        return new ApiClientFixture(
71
            $this->getMockBuilder(ObjectManager::class)->getMock(),
72
            $this->getMockBuilder(ExampleFactoryInterface::class)->getMock()
73
        );
74
    }
75
}
76