Completed
Push — master ( e22522...ee64fa )
by Sergei
13:37
created

UsersControllerTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Modera\BackendSecurityBundle\Tests\Unit\Controller;
4
5
use Modera\BackendSecurityBundle\Controller\UsersController;
6
7
/**
8
 * Refactored to be a Unit test.
9
 *
10
 * @author    Sergei Vizel <[email protected]>
11
 * @copyright 2014 Modera Foundation
12
 */
13
class UsersControllerTest extends \PHPUnit_Framework_TestCase
14
{
15
    /**
16
     * @var UsersController
17
     */
18
    private $controller;
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function setUp()
24
    {
25
        $this->controller = new UsersController();
26
    }
27
28
    public function testGeneratePasswordAction()
29
    {
30
        $result = $this->controller->generatePasswordAction(array());
31
32
        $this->assertTrue(is_array($result));
33
        $this->assertArrayHasKey('success', $result);
34
        $this->assertTrue($result['success']);
35
        $this->assertArrayHasKey('result', $result);
36
        $this->assertTrue(is_array($result['result']));
37
        $this->assertEquals(1, count($result['result']));
38
        $this->assertArrayHasKey('plainPassword', $result['result']);
39
        $this->assertGreaterThan(0, strlen($result['result']['plainPassword']));
40
    }
41
}
42