EmptyBannerSelectionDataTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 14
dl 0
loc 25
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A test_given_inactive_campaign_for_visitor_then_get_campaign_end_throws_exception() 0 6 1
A test_given_inactive_campaign_for_visitor_then_banner_is_not_displayed() 0 6 1
A test_given_inactive_campaign_for_visitor_then_get_banner_identifier_throws_exception() 0 6 1
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\BannerServer\Tests\Unit\UseCase\BannerSelection;
6
7
use PHPUnit\Framework\Attributes\CoversClass;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\Attributes\CoversClass was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use PHPUnit\Framework\TestCase;
9
use WMDE\BannerServer\Tests\Fixtures\VisitorFixture;
10
use WMDE\BannerServer\UseCase\BannerSelection\EmptyBannerSelectionData;
11
12
#[CoversClass( EmptyBannerSelectionData::class )]
13
class EmptyBannerSelectionDataTest extends TestCase {
14
15
	public function test_given_inactive_campaign_for_visitor_then_banner_is_not_displayed(): void {
16
		$bannerSelectionData = new EmptyBannerSelectionData(
17
			VisitorFixture::getTestVisitor()
18
		);
19
		$this->assertFalse( $bannerSelectionData->displayBanner() );
20
		$this->assertEquals( VisitorFixture::getTestVisitor(), $bannerSelectionData->getVisitorData() );
21
	}
22
23
	public function test_given_inactive_campaign_for_visitor_then_get_campaign_end_throws_exception(): void {
24
		$bannerSelectionData = new EmptyBannerSelectionData(
25
			VisitorFixture::getTestVisitor()
26
		);
27
		$this->expectException( 'LogicException' );
28
		$bannerSelectionData->getCampaignEnd();
29
	}
30
31
	public function test_given_inactive_campaign_for_visitor_then_get_banner_identifier_throws_exception(): void {
32
		$bannerSelectionData = new EmptyBannerSelectionData(
33
			VisitorFixture::getTestVisitor()
34
		);
35
		$this->expectException( 'LogicException' );
36
		$bannerSelectionData->getBannerIdentifier();
37
	}
38
}
39