mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix test coverage.
This commit is contained in:
parent
20490fcd80
commit
29a81eb05e
@ -141,9 +141,11 @@ class UserEventHandler
|
|||||||
$uri = route('profile.confirm-email-change', [$token->data]);
|
$uri = route('profile.confirm-email-change', [$token->data]);
|
||||||
try {
|
try {
|
||||||
Mail::to($newEmail)->send(new ConfirmEmailChangeMail($newEmail, $oldEmail, $uri, $ipAddress));
|
Mail::to($newEmail)->send(new ConfirmEmailChangeMail($newEmail, $oldEmail, $uri, $ipAddress));
|
||||||
|
// @codeCoverageIgnoreStart
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -165,9 +167,11 @@ class UserEventHandler
|
|||||||
$uri = route('profile.undo-email-change', [$token->data, hash('sha256', $oldEmail)]);
|
$uri = route('profile.undo-email-change', [$token->data, hash('sha256', $oldEmail)]);
|
||||||
try {
|
try {
|
||||||
Mail::to($oldEmail)->send(new UndoEmailChangeMail($newEmail, $oldEmail, $uri, $ipAddress));
|
Mail::to($oldEmail)->send(new UndoEmailChangeMail($newEmail, $oldEmail, $uri, $ipAddress));
|
||||||
|
// @codeCoverageIgnoreStart
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -190,9 +194,11 @@ class UserEventHandler
|
|||||||
// send email.
|
// send email.
|
||||||
try {
|
try {
|
||||||
Mail::to($email)->send(new RequestedNewPasswordMail($url, $ipAddress));
|
Mail::to($email)->send(new RequestedNewPasswordMail($url, $ipAddress));
|
||||||
|
// @codeCoverageIgnoreStart
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -217,9 +223,11 @@ class UserEventHandler
|
|||||||
// send email.
|
// send email.
|
||||||
try {
|
try {
|
||||||
Mail::to($email)->send(new RegisteredUserMail($uri, $ipAddress));
|
Mail::to($email)->send(new RegisteredUserMail($uri, $ipAddress));
|
||||||
|
// @codeCoverageIgnoreStart
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
// @codeCoverageIgnoreEnd
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -271,6 +271,7 @@ class SplitControllerTest extends TestCase
|
|||||||
$billRepos = $this->mock(BillRepositoryInterface::class);
|
$billRepos = $this->mock(BillRepositoryInterface::class);
|
||||||
|
|
||||||
$billRepos->shouldReceive('scan');
|
$billRepos->shouldReceive('scan');
|
||||||
|
$ruleRepos->shouldReceive('setUser')->once();
|
||||||
$ruleRepos->shouldReceive('getActiveGroups')->andReturn(new Collection);
|
$ruleRepos->shouldReceive('getActiveGroups')->andReturn(new Collection);
|
||||||
|
|
||||||
|
|
||||||
@ -368,6 +369,7 @@ class SplitControllerTest extends TestCase
|
|||||||
$billRepos = $this->mock(BillRepositoryInterface::class);
|
$billRepos = $this->mock(BillRepositoryInterface::class);
|
||||||
|
|
||||||
$billRepos->shouldReceive('scan');
|
$billRepos->shouldReceive('scan');
|
||||||
|
$ruleRepos->shouldReceive('setUser')->once();
|
||||||
$ruleRepos->shouldReceive('getActiveGroups')->andReturn(new Collection);
|
$ruleRepos->shouldReceive('getActiveGroups')->andReturn(new Collection);
|
||||||
|
|
||||||
|
|
||||||
@ -424,6 +426,7 @@ class SplitControllerTest extends TestCase
|
|||||||
$billRepos = $this->mock(BillRepositoryInterface::class);
|
$billRepos = $this->mock(BillRepositoryInterface::class);
|
||||||
|
|
||||||
$billRepos->shouldReceive('scan');
|
$billRepos->shouldReceive('scan');
|
||||||
|
$ruleRepos->shouldReceive('setUser')->once();
|
||||||
$ruleRepos->shouldReceive('getActiveGroups')->andReturn(new Collection);
|
$ruleRepos->shouldReceive('getActiveGroups')->andReturn(new Collection);
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,9 +34,10 @@ use FireflyIII\Models\Role;
|
|||||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||||
use Illuminate\Auth\Events\Login;
|
use Illuminate\Auth\Events\Login;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use Mockery;
|
|
||||||
use Tests\TestCase;
|
|
||||||
use Log;
|
use Log;
|
||||||
|
use Mockery;
|
||||||
|
use Preferences;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class UserEventHandlerTest
|
* Class UserEventHandlerTest
|
||||||
@ -151,6 +152,26 @@ class UserEventHandlerTest extends TestCase
|
|||||||
$this->assertTrue(true);
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \FireflyIII\Handlers\Events\UserEventHandler
|
||||||
|
*/
|
||||||
|
public function testDemoUserBackToEnglish(): void
|
||||||
|
{
|
||||||
|
$repository = $this->mock(UserRepositoryInterface::class);
|
||||||
|
$user = $this->emptyUser();
|
||||||
|
$event = new Login($user, true);
|
||||||
|
$listener = new UserEventHandler();
|
||||||
|
|
||||||
|
// mock stuff
|
||||||
|
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->once()->andReturn(true);
|
||||||
|
|
||||||
|
Preferences::shouldReceive('setForUser')->withArgs([Mockery::any(), 'language', 'en_US'])->once();
|
||||||
|
Preferences::shouldReceive('mark')->once();
|
||||||
|
|
||||||
|
$listener->demoUserBackToEnglish($event);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Handlers\Events\UserEventHandler
|
* @covers \FireflyIII\Handlers\Events\UserEventHandler
|
||||||
* @covers \FireflyIII\Events\UserChangedEmail
|
* @covers \FireflyIII\Events\UserChangedEmail
|
||||||
|
@ -32,9 +32,9 @@ use FireflyIII\Models\Configuration;
|
|||||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||||
use FireflyIII\Services\Github\Object\Release;
|
use FireflyIII\Services\Github\Object\Release;
|
||||||
use FireflyIII\Services\Github\Request\UpdateRequest;
|
use FireflyIII\Services\Github\Request\UpdateRequest;
|
||||||
|
use Log;
|
||||||
use Mockery;
|
use Mockery;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
use Log;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class VersionCheckEventHandlerTest
|
* Class VersionCheckEventHandlerTest
|
||||||
@ -52,7 +52,8 @@ class VersionCheckEventHandlerTest extends TestCase
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @covers \FireflyIII\Events\RequestedVersionCheckStatus
|
||||||
|
* @covers \FireflyIII\Handlers\Events\VersionCheckEventHandler
|
||||||
*/
|
*/
|
||||||
public function testCheckForUpdatesError(): void
|
public function testCheckForUpdatesError(): void
|
||||||
{
|
{
|
||||||
@ -114,7 +115,8 @@ class VersionCheckEventHandlerTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @covers \FireflyIII\Events\RequestedVersionCheckStatus
|
||||||
|
* @covers \FireflyIII\Handlers\Events\VersionCheckEventHandler
|
||||||
*/
|
*/
|
||||||
public function testCheckForUpdatesNoAdmin(): void
|
public function testCheckForUpdatesNoAdmin(): void
|
||||||
{
|
{
|
||||||
@ -156,7 +158,22 @@ class VersionCheckEventHandlerTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @covers \FireflyIII\Events\RequestedVersionCheckStatus
|
||||||
|
* @covers \FireflyIII\Handlers\Events\VersionCheckEventHandler
|
||||||
|
*/
|
||||||
|
public function testCheckForUpdatesSandstorm(): void
|
||||||
|
{
|
||||||
|
putenv('SANDSTORM=1');
|
||||||
|
|
||||||
|
$event = new RequestedVersionCheckStatus($this->user());
|
||||||
|
$handler = new VersionCheckEventHandler;
|
||||||
|
$handler->checkForUpdates($event);
|
||||||
|
putenv('SANDSTORM=0');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \FireflyIII\Events\RequestedVersionCheckStatus
|
||||||
|
* @covers \FireflyIII\Handlers\Events\VersionCheckEventHandler
|
||||||
*/
|
*/
|
||||||
public function testCheckForUpdatesTooRecent(): void
|
public function testCheckForUpdatesTooRecent(): void
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user