Code Duplication    Length = 18-19 lines in 2 locations

tests/unit/PartialSubmissionTaskTest.php 2 locations

@@ 45-63 (lines=19) @@
42
        $this->assertEmailSent('[email protected]');
43
    }
44
45
    public function testExtraUser()
46
    {
47
        $config = SiteConfig::current_site_config();
48
        $config->SendDailyEmail = true;
49
        $config->SendMailTo = '[email protected]';
50
        $config->write();
51
        $rand = uniqid('', false);
52
        $user = Member::create(['FirstName' => 'Test', 'Email' => $rand . '@example.com']);
53
        $user->write();
54
        Security::setCurrentUser($user);
55
        $request = new HTTPRequest('GET', 'dev/tasks/partialsubmissiontask');
56
57
        $task = Injector::inst()->get(PartialSubmissionTask::class);
58
59
        $task->run($request);
60
61
        $this->assertEmailSent($rand . '@example.com');
62
        $this->assertEmailSent('[email protected]');
63
    }
64
65
    public function testNoConfigButUser()
66
    {
@@ 65-82 (lines=18) @@
62
        $this->assertEmailSent('[email protected]');
63
    }
64
65
    public function testNoConfigButUser()
66
    {
67
        $rand = uniqid('', false);
68
        $user = Member::create(['FirstName' => 'Test', 'Email' => $rand . '@example.com']);
69
        $user->write();
70
        Security::setCurrentUser($user);
71
        $config = SiteConfig::current_site_config();
72
        $config->SendDailyEmail = true;
73
        $config->write();
74
        $request = new HTTPRequest('GET', 'dev/tasks/partialsubmissiontask');
75
76
        $task = Injector::inst()->get(PartialSubmissionTask::class);
77
78
        $task->run($request);
79
80
        $this->assertEmailSent($rand . '@example.com');
81
82
    }
83
84
    protected function setUp()
85
    {