blob: 357dcd0354f9156c4d7d96331689e89ab81fb30b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
<?php
/**
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\CustomDimensions\tests\Unit\Dimension;
use Piwik\Plugins\CustomDimensions\Dimension\Scope;
/**
* @group CustomDimensions
* @group ScopeTest
* @group Scope
* @group Plugins
*/
class ScopeTest extends \PHPUnit\Framework\TestCase
{
public function test_check_shouldFailWhenScopeIsEmpty()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessage("Invalid value '' for 'scope' specified. Available scopes are: visit, action, conversion");
$this->buildScope('')->check();
}
public function test_check_shouldFailWhenScopeIsNotValid()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessage("Invalid value 'anyScoPe' for 'scope' specified. Available scopes are: visit, action, conversion");
$this->buildScope('anyScoPe')->check();
}
public function test_check_shouldNotFailWhenScopeIsValid()
{
$this->buildScope('action')->check();
$this->buildScope('visit')->check();
$this->buildScope('conversion')->check();
self::assertTrue(true);
}
private function buildScope($scope)
{
return new Scope($scope);
}
}
|