|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare( strict_types = 1 ); |
|
4
|
|
|
|
|
5
|
|
|
namespace WMDE\BannerServer\Tests\Unit\UseCase\BannerSelection; |
|
6
|
|
|
|
|
7
|
|
|
use WMDE\BannerServer\Tests\Fixtures\VisitorFixture; |
|
8
|
|
|
use WMDE\BannerServer\UseCase\BannerSelection\ActiveBannerSelectionData; |
|
9
|
|
|
use WMDE\BannerServer\UseCase\BannerSelection\EmptyBannerSelectionData; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* @covers \WMDE\BannerServer\UseCase\BannerSelection\EmptyBannerSelectionData |
|
13
|
|
|
* Class EmptyBannerSelectionDataTest |
|
14
|
|
|
*/ |
|
15
|
|
|
class EmptyBannerSelectionDataTest extends \PHPUnit\Framework\TestCase { |
|
16
|
|
|
|
|
17
|
|
|
const BANNER_TEST_IDENTIFIER = 'testIdentifier'; |
|
18
|
|
|
const TEST_DATETIME = '19-06-1992 01:02:03'; |
|
19
|
|
|
|
|
20
|
|
|
public function test_given_inactive_campaign_for_visitor_then_banner_is_not_displayed() { |
|
21
|
|
|
$bannerSelectionData = new EmptyBannerSelectionData( |
|
22
|
|
|
VisitorFixture::getTestVisitor() |
|
23
|
|
|
); |
|
24
|
|
|
$this->assertFalse( $bannerSelectionData->displayBanner() ); |
|
25
|
|
|
$this->assertEquals( VisitorFixture::getTestVisitor(), $bannerSelectionData->getVisitorData() ); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
public function test_given_inactive_campaign_for_visitor_then_get_campaign_end_throws_exception() { |
|
29
|
|
|
$bannerSelectionData = new EmptyBannerSelectionData( |
|
30
|
|
|
VisitorFixture::getTestVisitor() |
|
31
|
|
|
); |
|
32
|
|
|
$this->expectException( 'LogicException' ); |
|
33
|
|
|
$bannerSelectionData->getCampaignEnd(); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
public function test_given_inactive_campaign_for_visitor_then_get_banner_identifier_throws_exception() { |
|
37
|
|
|
$bannerSelectionData = new EmptyBannerSelectionData( |
|
38
|
|
|
VisitorFixture::getTestVisitor() |
|
39
|
|
|
); |
|
40
|
|
|
$this->expectException( 'LogicException' ); |
|
41
|
|
|
$bannerSelectionData->getBannerIdentifier(); |
|
42
|
|
|
} |
|
43
|
|
|
} |
|
44
|
|
|
|