• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

daycry / auth / 16344800892

17 Jul 2025 12:13PM UTC coverage: 66.494% (+6.6%) from 59.854%
16344800892

push

github

daycry
Add comprehensive unit tests for helpers and services

This commit introduces extensive unit tests for helper functions (auth, checkEndpoint, checkIp, email), libraries (CheckIpInRange, Logger), and service classes (AttemptHandler, ExceptionHandler, RequestLogger). Also fixes ReflectionProperty usage in ExceptionHandler to correctly pass the exception object. These tests improve code coverage and ensure reliability of authentication, endpoint, IP checking, email, logging, and exception handling features.

1 of 1 new or added line in 1 file covered. (100.0%)

136 existing lines in 8 files now uncovered.

2177 of 3274 relevant lines covered (66.49%)

32.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Controllers/ActionController.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of Daycry Auth.
7
 *
8
 * (c) Daycry <daycry9@proton.me>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13

14
namespace Daycry\Auth\Controllers;
15

16
use CodeIgniter\Exceptions\PageNotFoundException;
17
use CodeIgniter\HTTP\Response;
18
use Daycry\Auth\Interfaces\ActionInterface;
19

20
/**
21
 * Class ActionController
22
 *
23
 * A generic controller to handle Authentication Actions.
24
 */
25
class ActionController extends BaseAuthController
26
{
27
    protected ?ActionInterface $action = null;
28

29
    /**
30
     * Perform an initial check if we have a valid action or not.
31
     *
32
     * @param list<string> $params
33
     *
34
     * @return Response|string
35
     */
36
    public function _remap(string $method, ...$params)
37
    {
UNCOV
38
        $authenticator = $this->getSessionAuthenticator();
×
39

40
        // Grab our action instance if one has been set.
UNCOV
41
        $this->action = $authenticator->getAction();
×
42

UNCOV
43
        if (empty($this->action) || ! $this->action instanceof ActionInterface) {
×
UNCOV
44
            throw new PageNotFoundException();
×
45
        }
46

UNCOV
47
        return $this->{$method}(...$params);
×
48
    }
49

50
    /**
51
     * Shows the initial screen to the user to start the flow.
52
     * This might be asking for the user's email to reset a password,
53
     * or asking for a cell-number for a 2FA.
54
     *
55
     * @return Response|string
56
     */
57
    public function show()
58
    {
UNCOV
59
        return $this->action->show();
×
60
    }
61

62
    /**
63
     * Processes the form that was displayed in the previous form.
64
     *
65
     * @return Response|string
66
     */
67
    public function handle()
68
    {
UNCOV
69
        return $this->action->handle($this->request);
×
70
    }
71

72
    /**
73
     * This handles the response after the user takes action
74
     * in response to the show/handle flow. This might be
75
     * from clicking the 'confirm my email' action or
76
     * following entering a code sent in an SMS.
77
     *
78
     * @return Response|string
79
     */
80
    public function verify()
81
    {
UNCOV
82
        return $this->action->verify($this->request);
×
83
    }
84

85
    /**
86
     * ActionController doesn't use validation rules directly
87
     * as it delegates to action objects
88
     */
89
    protected function getValidationRules(): array
90
    {
UNCOV
91
        return [];
×
92
    }
93
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc