Download plugins/CustomDimensions/tests/Unit/Dimension/ActiveTest.php from Leon4gr45/matomo: direct link, hf CLI and curl.
- Browser
- Download file 1.7 kB
-
https://huggingface.co/spaces/Leon4gr45/matomo/resolve/main/plugins/CustomDimensions/tests/Unit/Dimension/ActiveTest.php
- Command line
-
hf download hf://spaces/Leon4gr45/matomo/plugins/CustomDimensions/tests/Unit/Dimension/ActiveTest.php
-
curl -L -o ActiveTest.php https://huggingface.co/spaces/Leon4gr45/matomo/resolve/main/plugins/CustomDimensions/tests/Unit/Dimension/ActiveTest.php
1.7 kB
| /** | |
| * Matomo - free/libre analytics platform | |
| * | |
| * @link https://matomo.org | |
| * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | |
| */ | |
| namespace Piwik\Plugins\CustomDimensions\tests\Unit\Dimension; | |
| use Piwik\Plugins\CustomDimensions\Dimension\Active; | |
| /** | |
| * @group CustomDimensions | |
| * @group ActiveTest | |
| * @group Active | |
| * @group Plugins | |
| */ | |
| class ActiveTest extends \PHPUnit\Framework\TestCase | |
| { | |
| public function testCheckShouldFailWhenActiveIsEmpty() | |
| { | |
| $this->expectException(\Exception::class); | |
| $this->expectExceptionMessage("Invalid value '' for 'active' specified. Allowed values: '0' or '1'"); | |
| $this->buildActive('')->check(); | |
| } | |
| public function testCheckShouldFailWhenActiveIsNotValid() | |
| { | |
| $this->expectException(\Exception::class); | |
| $this->expectExceptionMessage("Invalid value 'anyValUe' for 'active' specified. Allowed values: '0' or '1'"); | |
| $this->buildActive('anyValUe')->check(); | |
| } | |
| public function testCheckShouldFailWhenActiveIsNumericButNot0or1() | |
| { | |
| $this->expectException(\Exception::class); | |
| $this->expectExceptionMessage("Invalid value '2'"); | |
| $this->buildActive('2')->check(); | |
| } | |
| public function testCheckShouldNotFailWhenActiveIsValid() | |
| { | |
| self::expectNotToPerformAssertions(); | |
| $this->buildActive(true)->check(); | |
| $this->buildActive(false)->check(); | |
| $this->buildActive(0)->check(); | |
| $this->buildActive(1)->check(); | |
| $this->buildActive('0')->check(); | |
| $this->buildActive('1')->check(); | |
| } | |
| private function buildActive($active) | |
| { | |
| return new Active($active); | |
| } | |
| } | |