Completed
Push — 1.2-commands ( 515a1b )
by Kamil
131:33 queued 110:12
created

AdminUserFixtureTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 1
dl 0
loc 56
c 0
b 0
f 0
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A users_are_optional() 0 4 1
A users_can_be_generated_randomly() 0 5 1
A user_username_is_optional() 0 4 1
A user_may_be_toggled() 0 4 1
A user_password_code_is_optional() 0 4 1
A getConfiguration() 0 7 1
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\CoreBundle\Tests\Fixture;
15
16
use Doctrine\Common\Persistence\ObjectManager;
17
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait;
18
use PHPUnit\Framework\TestCase;
19
use Sylius\Bundle\CoreBundle\Fixture\AdminUserFixture;
20
use Sylius\Bundle\CoreBundle\Fixture\Factory\ExampleFactoryInterface;
21
22
final class AdminUserFixtureTest extends TestCase
23
{
24
    use ConfigurationTestCaseTrait;
25
26
    /**
27
     * @test
28
     */
29
    public function users_are_optional(): void
30
    {
31
        $this->assertConfigurationIsValid([[]], 'custom');
32
    }
33
34
    /**
35
     * @test
36
     */
37
    public function users_can_be_generated_randomly(): void
38
    {
39
        $this->assertConfigurationIsValid([['random' => 4]], 'random');
40
        $this->assertPartialConfigurationIsInvalid([['random' => -1]], 'random');
41
    }
42
43
    /**
44
     * @test
45
     */
46
    public function user_username_is_optional(): void
47
    {
48
        $this->assertConfigurationIsValid([['custom' => [['username' => 'John Doe']]]], 'custom.*.username');
49
    }
50
51
    /**
52
     * @test
53
     */
54
    public function user_may_be_toggled(): void
55
    {
56
        $this->assertConfigurationIsValid([['custom' => [['enabled' => false]]]], 'custom.*.enabled');
57
    }
58
59
    /**
60
     * @test
61
     */
62
    public function user_password_code_is_optional(): void
63
    {
64
        $this->assertConfigurationIsValid([['custom' => [['password' => 'I.<3.Krzysztof.Krawczyk']]]], 'custom.*.password');
65
    }
66
67
    /**
68
     * {@inheritdoc}
69
     */
70
    protected function getConfiguration(): AdminUserFixture
71
    {
72
        return new AdminUserFixture(
73
            $this->getMockBuilder(ObjectManager::class)->getMock(),
74
            $this->getMockBuilder(ExampleFactoryInterface::class)->getMock()
75
        );
76
    }
77
}
78