You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Mods-for-HESK-Netsyms/api/Tests/BusinessLogic/Tests/BanRetrieverTest.php

35 lines
850 B
PHP

<?php
/**
* Created by PhpStorm.
* User: mkoch
* Date: 2/2/2017
* Time: 9:57 PM
*/
namespace Tests;
use BusinessLogic\Security\BannedEmail;
use BusinessLogic\Security\BanRetriever;
use DataAccess\Security\BanGateway;
use PHPUnit\Framework\TestCase;
class BanRetrieverTests extends TestCase {
function testItReturnsTrueWhenTheIpIsBanned() {
//-- Arrange
$banGateway = $this->createMock(BanGateway::class);
$banRetriever = new BanRetriever($banGateway);
$bannedEmail = new BannedEmail();
$bannedEmail->email = 'my@email.address';
$banGateway->method('getEmailBans')
->willReturn([$bannedEmail]);
//-- Act
$result = $banRetriever->isEmailBanned('my@email.address', null);
//-- Assert
$this->assertThat($result, $this->isTrue());
}
}