diff options
Diffstat (limited to 'plugins/SegmentEditor/tests')
-rw-r--r-- | plugins/SegmentEditor/tests/Integration/SegmentFormatterTest.php | 8 | ||||
-rw-r--r-- | plugins/SegmentEditor/tests/Integration/SegmentListTest.php | 73 |
2 files changed, 4 insertions, 77 deletions
diff --git a/plugins/SegmentEditor/tests/Integration/SegmentFormatterTest.php b/plugins/SegmentEditor/tests/Integration/SegmentFormatterTest.php index a7db9f6666..0e0f250351 100644 --- a/plugins/SegmentEditor/tests/Integration/SegmentFormatterTest.php +++ b/plugins/SegmentEditor/tests/Integration/SegmentFormatterTest.php @@ -9,7 +9,7 @@ namespace Piwik\Plugins\SegmentEditor\tests\Integration; use Piwik\Plugins\SegmentEditor\SegmentFormatter; -use Piwik\Plugins\SegmentEditor\SegmentList; +use Piwik\Segment\SegmentsList; use Piwik\Tests\Framework\Fixture; use Piwik\Tests\Framework\TestCase\IntegrationTestCase; @@ -32,10 +32,10 @@ class SegmentFormatterTest extends IntegrationTestCase { parent::setUp(); - $this->idSite = Fixture::createWebsite('2012-01-01 00:00:00'); - $this->formatter = new SegmentFormatter(new SegmentList()); - Fixture::loadAllTranslations(); + + $this->idSite = Fixture::createWebsite('2012-01-01 00:00:00'); + $this->formatter = new SegmentFormatter(SegmentsList::get()); } public function tearDown(): void diff --git a/plugins/SegmentEditor/tests/Integration/SegmentListTest.php b/plugins/SegmentEditor/tests/Integration/SegmentListTest.php deleted file mode 100644 index 3a66a4bd4e..0000000000 --- a/plugins/SegmentEditor/tests/Integration/SegmentListTest.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php -/** - * Piwik - 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\SegmentEditor\tests\Integration; - -use Piwik\Plugins\SegmentEditor\SegmentList; -use Piwik\Tests\Framework\Fixture; -use Piwik\Tests\Framework\Mock\FakeAccess; -use Piwik\Tests\Framework\TestCase\IntegrationTestCase; -use Exception; - -/** - * @group SegmentListTest - * @group SegmentList - * @group SegmentEditor - * @group Plugins - */ -class SegmentListTest extends IntegrationTestCase -{ - /** - * @var SegmentList - */ - private $list; - - private $idSite; - - public function setUp(): void - { - parent::setUp(); - - $this->idSite = Fixture::createWebsite('2012-01-01 00:00:00'); - $this->list = new SegmentList(); - } - - public function test_findSegment_shouldFindSegmentByName_IfNameExists() - { - $segmentName = 'pageUrl'; - - $segment = $this->list->findSegment($segmentName, $this->idSite); - self::assertIsArray($segment); - $this->assertSame($segmentName, $segment['segment']); - } - - public function test_findSegment_shouldNotFindSegmentByName_IfNameDoesNotExist() - { - $segment = $this->list->findSegment('aNyNotExisTinGSegmEnt', $this->idSite); - $this->assertNull($segment); - } - - public function test_findSegment_ShouldThrowException_IfNotEnoughPermission() - { - $this->expectException(\Exception::class); - $this->expectExceptionMessage('checkUserHasViewAccess'); - - FakeAccess::clearAccess($superUser = false, array(1)); - - $segment = $this->list->findSegment('pageUrl', 999); - $this->assertNull($segment); - } - - public function provideContainerConfig() - { - return array( - 'Piwik\Access' => new FakeAccess() - ); - } - -} |