diff options
Diffstat (limited to 'plugins/CustomDimensions/tests/Unit/Dimension/ScopeTest.php')
m--------- | plugins/CustomDimensions | 0 | ||||
-rw-r--r-- | plugins/CustomDimensions/tests/Unit/Dimension/ScopeTest.php | 50 |
2 files changed, 50 insertions, 0 deletions
diff --git a/plugins/CustomDimensions b/plugins/CustomDimensions deleted file mode 160000 -Subproject 318661a2fb1ef3b3e5d6d999ae8b9628cb5a113 diff --git a/plugins/CustomDimensions/tests/Unit/Dimension/ScopeTest.php b/plugins/CustomDimensions/tests/Unit/Dimension/ScopeTest.php new file mode 100644 index 0000000000..357dcd0354 --- /dev/null +++ b/plugins/CustomDimensions/tests/Unit/Dimension/ScopeTest.php @@ -0,0 +1,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); + } + +} |