ResetPasswordRequestActionTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Importance

Changes 0
Metric Value
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 7

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A tearDown() 0 5 1
A testSuccessResetPasswordRequest() 0 11 1
1
<?php
2
/**
3
 * Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
4
 *
5
 * Licensed under The MIT License
6
 * Redistributions of files must retain the above copyright notice.
7
 *
8
 * @copyright Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
9
 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
10
 */
11
12
namespace CakeDC\Api\Test\TestCase\Integration\Service\Action\Auth;
13
14
use CakeDC\Api\TestSuite\IntegrationTestCase;
15
use CakeDC\Api\Test\ConfigTrait;
16
use CakeDC\Api\Test\FixturesTrait;
17
use CakeDC\Api\Test\Settings;
18
use Cake\Core\Configure;
19
use Cake\ORM\TableRegistry;
20
use Cake\Utility\Hash;
21
22
/**
23
 * Class ResetPasswordRequestActionTest
24
 *
25
 * @package CakeDC\Api\Test\TestCase\Integration\Service\Action\Auth
26
 */
27
class ResetPasswordRequestActionTest extends IntegrationTestCase
28
{
29
30
    use ConfigTrait;
31
    use FixturesTrait;
32
33
    /**
34
     * setUp
35
     *
36
     * @return void
37
     */
38
    public function setUp()
39
    {
40
        parent::setUp();
41
        $this->_authAccess();
42
        Configure::write('App.fullBaseUrl', 'http://example.com');
43
    }
44
45
    /**
46
     * tearDown
47
     *
48
     * @return void
49
     */
50
    public function tearDown()
51
    {
52
        parent::tearDown();
53
        Configure::write('Test.Api.Extension', null);
54
    }
55
56
    public function testSuccessResetPasswordRequest()
57
    {
58
        $this->sendRequest('/auth/reset_password_request', 'POST', ['reference' => 'user-1']);
59
        $result = $this->getJsonResponse();
60
        $this->assertSuccess($result);
61
        $this->assertTextEquals('Please check your email to continue with password reset process', $result['data']);
62
63
        $Users = TableRegistry::get('CakeDC/Users.Users');
0 ignored issues
show
Deprecated Code introduced by
The method Cake\ORM\TableRegistry::get() has been deprecated with message: 3.6.0 Use \Cake\ORM\Locator\TableLocator::get() instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
64
        $user = $Users->find()->where(['id' => Settings::USER1])->enableHydration(false)->first();
65
        $this->assertNotEmpty($user['token']);
66
    }
67
}
68