ValidateAccountRequestActionTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A tearDown() 0 5 1
A testSuccessValidateAccountRequest() 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
21
/**
22
 * Class ValidateAccountRequestActionTest
23
 *
24
 * @package CakeDC\Api\Test\TestCase\Integration\Service\Action\Auth
25
 */
26
class ValidateAccountRequestActionTest extends IntegrationTestCase
27
{
28
29
    use ConfigTrait;
30
    use FixturesTrait;
31
32
    /**
33
     * setUp
34
     *
35
     * @return void
36
     */
37
    public function setUp()
38
    {
39
        parent::setUp();
40
        Configure::write('App.fullBaseUrl', 'http://example.com');
41
    }
42
43
    /**
44
     * tearDown
45
     *
46
     * @return void
47
     */
48
    public function tearDown()
49
    {
50
        parent::tearDown();
51
        Configure::write('Test.Api.Extension', null);
52
    }
53
54
    public function testSuccessValidateAccountRequest()
55
    {
56
        $this->sendRequest('/auth/validate_account_request', 'POST', ['reference' => 'user-6']);
57
        $result = $this->getJsonResponse();
58
        $this->assertSuccess($result);
59
        $this->assertTextEquals('Token has been reset successfully. Please check your email.', $result['data']);
60
61
        $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...
62
        $user = $Users->find()->where(['id' => Settings::USER6])->enableHydration(false)->first();
63
        $this->assertNotEmpty($user['token']);
64
    }
65
}
66