diff --git a/plugins/CustomDimensions/tests/Integration/ApiTest.php b/plugins/CustomDimensions/tests/Integration/ApiTest.php index 42b88c40f8f..574d083b1f6 100644 --- a/plugins/CustomDimensions/tests/Integration/ApiTest.php +++ b/plugins/CustomDimensions/tests/Integration/ApiTest.php @@ -47,7 +47,7 @@ public function setUp(): void /** * @dataProvider getInvalidConfigForNewDimensions */ - public function test_configureNewDimension_shouldFailWhenThereIsAnError($dimension) + public function testConfigureNewDimensionShouldFailWhenThereIsAnError($dimension) { try { $this->api->configureNewCustomDimension($idSite = 1, $dimension['name'], $dimension['scope'], $dimension['active'], $dimension['extractions'], $dimension['case_sensitive']); @@ -71,7 +71,7 @@ public function getInvalidConfigForNewDimensions() ); } - public function test_configureNewDimension_shouldReturnCreatedIdOnSuccess() + public function testConfigureNewDimensionShouldReturnCreatedIdOnSuccess() { $id = $this->api->configureNewCustomDimension($idSite = 1, 'Valid Name äöü', CustomDimensions::SCOPE_ACTION, '1', array(array('dimension' => 'urlparam', 'pattern' => 'test')), '0'); @@ -95,7 +95,7 @@ public function test_configureNewDimension_shouldReturnCreatedIdOnSuccess() $this->assertSame(array($expectedDimension), $dimensions); } - public function test_configureNewDimension_shouldFailWhenNotHavingAdminPermissions() + public function testConfigureNewDimensionShouldFailWhenNotHavingAdminPermissions() { $this->expectException(\Exception::class); $this->expectExceptionMessage('checkUserHasWriteAccess'); @@ -107,10 +107,10 @@ public function test_configureNewDimension_shouldFailWhenNotHavingAdminPermissio /** * @dataProvider getInvalidConfigForExistingDimensions */ - public function test_configureExistingCustomDimension_shouldFailWhenThereIsAnError($dimension) + public function testConfigureExistingCustomDimensionShouldFailWhenThereIsAnError($dimension) { try { - $this->test_configureNewDimension_shouldReturnCreatedIdOnSuccess(); + $this->testConfigureNewDimensionShouldReturnCreatedIdOnSuccess(); $this->api->configureExistingCustomDimension($dimension['id'], $idSite = 1, $dimension['name'], $dimension['active'], $dimension['extractions']); } catch (Exception $e) { self::assertStringContainsString($dimension['message'], $e->getMessage()); @@ -130,9 +130,9 @@ public function getInvalidConfigForExistingDimensions() ); } - public function test_configureExistingCustomDimension_shouldReturnNothingOnSuccess() + public function testConfigureExistingCustomDimensionShouldReturnNothingOnSuccess() { - $this->test_configureNewDimension_shouldReturnCreatedIdOnSuccess(); + $this->testConfigureNewDimensionShouldReturnCreatedIdOnSuccess(); $return = $this->api->configureExistingCustomDimension($id = 1, $idSite = 1, 'New Valid Name äöü', '0', array(array('dimension' => 'urlparam', 'pattern' => 'newtest')), $caseSensitive = true); $this->assertNull($return); @@ -146,9 +146,9 @@ public function test_configureExistingCustomDimension_shouldReturnNothingOnSucce $this->assertSame('newtest', $dimensions[0]['extractions'][0]['pattern']); } - public function test_configureExistingCustomDimension_shouldNotChangeCaseSensitive_IfNoValuePassed() + public function testConfigureExistingCustomDimensionShouldNotChangeCaseSensitiveIfNoValuePassed() { - $this->test_configureNewDimension_shouldReturnCreatedIdOnSuccess(); + $this->testConfigureNewDimensionShouldReturnCreatedIdOnSuccess(); // verify created with false $dimensions = $this->api->getConfiguredCustomDimensions(1); @@ -163,7 +163,7 @@ public function test_configureExistingCustomDimension_shouldNotChangeCaseSensiti $this->assertFalse($dimensions[0]['case_sensitive']); } - public function test_configureExistingCustomDimension_shouldThrowException_WhenTryingToSetExtractionsForNonActionScope() + public function testConfigureExistingCustomDimensionShouldThrowExceptionWhenTryingToSetExtractionsForNonActionScope() { $this->expectException(\Exception::class); $this->expectExceptionMessage('Extractions can be used only in scope \'action\''); @@ -172,7 +172,7 @@ public function test_configureExistingCustomDimension_shouldThrowException_WhenT $this->api->configureExistingCustomDimension($id, $idSite, 'Name', '0', array(array('dimension' => 'urlparam', 'pattern' => 'newtest'))); } - public function test_configureExistingCustomDimension_shouldFailWhenNotHavingAdminPermissions() + public function testConfigureExistingCustomDimensionShouldFailWhenNotHavingAdminPermissions() { $this->expectException(\Exception::class); $this->expectExceptionMessage('checkUserHasWriteAccess'); @@ -181,7 +181,7 @@ public function test_configureExistingCustomDimension_shouldFailWhenNotHavingAdm $this->api->configureExistingCustomDimension($id = 1, $idSite = 1, 'New Valid Name äöü', '0', array(array('dimension' => 'urlparam', 'pattern' => 'newtest'))); } - public function test_getConfiguredCustomDimensions_shouldFailWhenNotHavingAdminPermissions() + public function testGetConfiguredCustomDimensionsShouldFailWhenNotHavingAdminPermissions() { $this->expectException(\Exception::class); $this->expectExceptionMessage('checkUserHasViewAccess'); @@ -190,7 +190,7 @@ public function test_getConfiguredCustomDimensions_shouldFailWhenNotHavingAdminP $this->api->getConfiguredCustomDimensions($idSite = 1); } - public function test_getAvailableScopes_shouldFailWhenNotHavingAdminPermissions() + public function testGetAvailableScopesShouldFailWhenNotHavingAdminPermissions() { $this->expectException(\Exception::class); $this->expectExceptionMessage('checkUserHasViewAccess'); @@ -199,7 +199,7 @@ public function test_getAvailableScopes_shouldFailWhenNotHavingAdminPermissions( $this->api->getAvailableScopes($idSite = 1); } - public function test_getAvailableExtractionDimensions_shouldFailWhenNotHavingAdminPermissions() + public function testGetAvailableExtractionDimensionsShouldFailWhenNotHavingAdminPermissions() { $this->expectException(\Exception::class); $this->expectExceptionMessage('checkUserHasSomeWriteAccess'); @@ -208,7 +208,7 @@ public function test_getAvailableExtractionDimensions_shouldFailWhenNotHavingAdm $this->api->getAvailableExtractionDimensions(); } - public function test_getCustomDimension_shouldFailWhenNotHavingViewPermissions() + public function testGetCustomDimensionShouldFailWhenNotHavingViewPermissions() { $this->expectException(\Exception::class); $this->expectExceptionMessage('checkUserHasViewAccess'); @@ -217,7 +217,7 @@ public function test_getCustomDimension_shouldFailWhenNotHavingViewPermissions() $this->api->getCustomDimension($idDimension = 1, $idSite = 1, $period = 'day', $date = 'today'); } - public function test_getConfiguredCustomDimensionsHavingScope_shouldFindEntriesHavingScopeAndSite() + public function testGetConfiguredCustomDimensionsHavingScopeShouldFindEntriesHavingScopeAndSite() { ConfigurationTest::createManyCustomDimensionCasesFor(new Configuration()); diff --git a/plugins/CustomDimensions/tests/Integration/CustomDimensionsTest.php b/plugins/CustomDimensions/tests/Integration/CustomDimensionsTest.php index cf383cefaa9..8ef45ea910a 100644 --- a/plugins/CustomDimensions/tests/Integration/CustomDimensionsTest.php +++ b/plugins/CustomDimensions/tests/Integration/CustomDimensionsTest.php @@ -43,7 +43,7 @@ public function setUp(): void $this->plugin = new CustomDimensions(); } - public function test_install_shouldCreate5IndexesPerScopeAndCreateConfigurationTable() + public function testInstallShouldCreate5IndexesPerScopeAndCreateConfigurationTable() { foreach (CustomDimensions::getScopes() as $scope) { $logTable = new LogTable($scope); @@ -54,7 +54,7 @@ public function test_install_shouldCreate5IndexesPerScopeAndCreateConfigurationT $this->configureSomeDimensions(); } - public function test_install_multipleTimes_ShouldNotChangeAnythingAndNotFail() + public function testInstallMultipleTimesShouldNotChangeAnythingAndNotFail() { $this->plugin->install(); $this->plugin->install(); @@ -70,7 +70,7 @@ public function test_install_multipleTimes_ShouldNotChangeAnythingAndNotFail() $this->configureSomeDimensions(); } - public function test_uninstall_shouldRemoveAllColumnsFromLogTablesAndUninstallConfigTable() + public function testUninstallShouldRemoveAllColumnsFromLogTablesAndUninstallConfigTable() { $this->plugin->uninstall(); foreach (CustomDimensions::getScopes() as $scope) { @@ -87,7 +87,7 @@ public function test_uninstall_shouldRemoveAllColumnsFromLogTablesAndUninstallCo $this->plugin->install(); } - public function test_addVisitFieldsToPersist() + public function testAddVisitFieldsToPersist() { $fields = array('existingField'); @@ -105,7 +105,7 @@ public function test_addVisitFieldsToPersist() $this->assertSame($expected, $fields); } - public function test_addConversionInformation() + public function testAddConversionInformation() { $this->configureSomeDimensions(); @@ -128,7 +128,7 @@ public function test_addConversionInformation() ), $conversion); } - public function test_addConversionInformation_shouldIgnoreAnIndexIfTheIndexIsMissingInConversionTable() + public function testAddConversionInformationShouldIgnoreAnIndexIfTheIndexIsMissingInConversionTable() { $this->configureSomeDimensions(); @@ -150,7 +150,7 @@ public function test_addConversionInformation_shouldIgnoreAnIndexIfTheIndexIsMis ), $conversion); } - public function test_getCachedInstalledIndexesForScope_shouldIgnoreAnIndexIfTheIndexIsMissingInConversionTable() + public function testGetCachedInstalledIndexesForScopeShouldIgnoreAnIndexIfTheIndexIsMissingInConversionTable() { $indexes = $this->plugin->getCachedInstalledIndexesForScope(CustomDimensions::SCOPE_CONVERSION); $this->assertSame(range(2, 5), $indexes); @@ -165,7 +165,7 @@ public function test_getCachedInstalledIndexesForScope_shouldIgnoreAnIndexIfTheI $this->assertSame(range(1, 5), $indexes); } - public function test_shouldCacheInstalledIndexes() + public function testShouldCacheInstalledIndexes() { Cache::clearCacheGeneral(); $cache = Cache::getCacheGeneral(); @@ -183,7 +183,7 @@ public function test_shouldCacheInstalledIndexes() } } - public function test_shouldCacheDimensinsViaWebsiteAttributes_ButOnlyActiveOnes() + public function testShouldCacheDimensinsViaWebsiteAttributesButOnlyActiveOnes() { $this->configureSomeDimensions(); $cache = Cache::getCacheWebsiteAttributes($idSite = 1); @@ -201,7 +201,7 @@ public function test_shouldCacheDimensinsViaWebsiteAttributes_ButOnlyActiveOnes( } } - public function test_extendVisitorDetails() + public function testExtendVisitorDetails() { $this->configureSomeDimensions(); @@ -227,7 +227,7 @@ public function test_extendVisitorDetails() $this->assertSame($expected, $visitor); } - public function test_deleteCustomDimensionDefinitionsForSite_shouldRemoveConfigurationsForOneSiteWhenSiteIsDeleted() + public function testDeleteCustomDimensionDefinitionsForSiteShouldRemoveConfigurationsForOneSiteWhenSiteIsDeleted() { $this->configureSomeDimensions(); $config = new Configuration(); @@ -245,7 +245,7 @@ public function test_deleteCustomDimensionDefinitionsForSite_shouldRemoveConfigu /** * @dataProvider getScopesSupportExtractions */ - public function test_doesScopeSupportExtractions($expectedSupportsExtractions, $scope) + public function testDoesScopeSupportExtractions($expectedSupportsExtractions, $scope) { $this->assertSame($expectedSupportsExtractions, CustomDimensions::doesScopeSupportExtractions($scope)); } diff --git a/plugins/CustomDimensions/tests/Integration/Dao/ConfigurationTest.php b/plugins/CustomDimensions/tests/Integration/Dao/ConfigurationTest.php index 06e28bc83ef..b85a28413d6 100644 --- a/plugins/CustomDimensions/tests/Integration/Dao/ConfigurationTest.php +++ b/plugins/CustomDimensions/tests/Integration/Dao/ConfigurationTest.php @@ -38,7 +38,7 @@ public function setUp(): void $this->tableName = Common::prefixTable('custom_dimensions'); } - public function test_shouldInstallConfigTable() + public function testShouldInstallConfigTable() { $columns = DbHelper::getTableColumns($this->tableName); $columns = array_keys($columns); @@ -49,7 +49,7 @@ public function test_shouldInstallConfigTable() $this->assertSame($expected, $columns); } - public function test_shouldBeAbleToUninstallConfigTable() + public function testShouldBeAbleToUninstallConfigTable() { $this->expectException(\Zend_Db_Statement_Exception::class); $this->expectExceptionMessage('custom_dimensions'); @@ -66,7 +66,7 @@ public function test_shouldBeAbleToUninstallConfigTable() $this->config->install(); } - public function test_configureNewDimension_shouldGenerateDimensionIdCorrectlyAndShouldNextFreeId() + public function testConfigureNewDimensionShouldGenerateDimensionIdCorrectlyAndShouldNextFreeId() { $cases = $this->createManyCustomDimensionCases(); @@ -82,7 +82,7 @@ public function test_configureNewDimension_shouldGenerateDimensionIdCorrectlyAnd } } - public function test_configureNewDimension_shouldNotBePossibleToAssignSameIndexForSameScopeAndIdSiteTwice() + public function testConfigureNewDimensionShouldNotBePossibleToAssignSameIndexForSameScopeAndIdSiteTwice() { $this->expectException(\Zend_Db_Statement_Exception::class); $this->expectExceptionMessage('Duplicate'); @@ -94,7 +94,7 @@ public function test_configureNewDimension_shouldNotBePossibleToAssignSameIndexF /** * @dataProvider getExtractionsProvider */ - public function test_shouldSaveExtractionsSerializedAndUnserializeWhenGettingThem($expectedExtractions, $extractions) + public function testShouldSaveExtractionsSerializedAndUnserializeWhenGettingThem($expectedExtractions, $extractions) { $idSite = 1; $name = 'Test'; @@ -119,7 +119,7 @@ public function test_shouldSaveExtractionsSerializedAndUnserializeWhenGettingThe /** * @dataProvider getExtractionsProvider */ - public function test_configureExistingDimension_shouldSerializeExtractionsAndGetThemCorrectly($expectedExtractions, $extractions) + public function testConfigureExistingDimensionShouldSerializeExtractionsAndGetThemCorrectly($expectedExtractions, $extractions) { $idSite = 1; $name = 'Test'; @@ -134,7 +134,7 @@ public function test_configureExistingDimension_shouldSerializeExtractionsAndGet $this->assertSame($expectedExtractions, $dimension['extractions']); } - public function test_configureExistingDimension_shouldUpdateDimensionWhenIdSiteMatches() + public function testConfigureExistingDimensionShouldUpdateDimensionWhenIdSiteMatches() { $idSite = 1; $idDimension = $this->configureNewDimension(); @@ -156,7 +156,7 @@ public function test_configureExistingDimension_shouldUpdateDimensionWhenIdSiteM $this->assertSame(false, $dimension['case_sensitive']); } - public function test_configureExistingDimension_shouldNotUpdateDimensionIfIdSiteDoesNotMatch() + public function testConfigureExistingDimensionShouldNotUpdateDimensionIfIdSiteDoesNotMatch() { $idDimension = $this->configureNewDimension(); @@ -198,7 +198,7 @@ public function getExtractionsProvider() return $tests; } - public function test_getCustomDimensionsForSite_shouldBeEmpty_IfThereAreNoCustomDimensions() + public function testGetCustomDimensionsForSiteShouldBeEmptyIfThereAreNoCustomDimensions() { $this->assertSame(array(), $this->config->getCustomDimensionsForSite($idSite = 1)); } @@ -208,7 +208,7 @@ private function configureNewDimension($idSite = 1, $name = 'Test', $scope = 'ac return $this->config->configureNewDimension($idSite, $name, $scope, $index, $active, $extractions, $caseSensitive = true); } - public function test_getCustomDimension_shouldOnlyFindDimensionMatchingIdDimensionAndIdSite() + public function testGetCustomDimensionShouldOnlyFindDimensionMatchingIdDimensionAndIdSite() { $this->createManyCustomDimensionCases(); @@ -223,7 +223,7 @@ public function test_getCustomDimension_shouldOnlyFindDimensionMatchingIdDimensi $this->assertNotEmpty($this->config->getCustomDimension($idDimension = 2, $idSite = 2)); } - public function test_getCustomDimension_shouldReturnDimension() + public function testGetCustomDimensionShouldReturnDimension() { $this->createManyCustomDimensionCases(); @@ -242,7 +242,7 @@ public function test_getCustomDimension_shouldReturnDimension() $this->assertSame($expected, $dimension); } - public function test_getCustomDimensionsForSite_shouldFindEntriesHavingThisSite() + public function testGetCustomDimensionsForSiteShouldFindEntriesHavingThisSite() { $this->createManyCustomDimensionCases(); @@ -267,7 +267,7 @@ public function test_getCustomDimensionsForSite_shouldFindEntriesHavingThisSite( $this->assertSame(array(), $dimensions); } - public function test_getCustomDimensionsHavingIndex_shouldFindEntriesHavingIndexAndSite() + public function testGetCustomDimensionsHavingIndexShouldFindEntriesHavingIndexAndSite() { $this->createManyCustomDimensionCases(); @@ -296,7 +296,7 @@ public function test_getCustomDimensionsHavingIndex_shouldFindEntriesHavingIndex $this->assertSame(array(), $dimensions); } - public function test_gdeleteConfigurationsForSite_shouldOnlyDeleteConfigsForThisSite() + public function testGdeleteConfigurationsForSiteShouldOnlyDeleteConfigsForThisSite() { $this->createManyCustomDimensionCases(); $idSite = 1; @@ -315,7 +315,7 @@ public function test_gdeleteConfigurationsForSite_shouldOnlyDeleteConfigsForThis $this->assertCount(3, $dimensions); } - public function test_getCustomDimensionsHavingIndex_shouldOnlyDeleteConfigsForThisSite() + public function testGetCustomDimensionsHavingIndexShouldOnlyDeleteConfigsForThisSite() { $this->createManyCustomDimensionCases(); $index = 1; diff --git a/plugins/CustomDimensions/tests/Integration/Dao/LogTableTest.php b/plugins/CustomDimensions/tests/Integration/Dao/LogTableTest.php index 9b777550b2c..8281e7d008f 100644 --- a/plugins/CustomDimensions/tests/Integration/Dao/LogTableTest.php +++ b/plugins/CustomDimensions/tests/Integration/Dao/LogTableTest.php @@ -61,26 +61,26 @@ public function tearDown(): void parent::tearDown(); } - public function test_shouldInstall5Indexes_ByDefault() + public function testShouldInstall5IndexesByDefault() { $this->assertSame(5, $this->logVisit->getNumInstalledIndexes()); $this->assertSame(5, $this->logAction->getNumInstalledIndexes()); $this->assertSame(5, $this->logConverison->getNumInstalledIndexes()); } - public function test_install_shouldInstallColumn_LogLinkVisitAction_TimeSpent() + public function testInstallShouldInstallColumnLogLinkVisitActionTimeSpent() { $columnn = DbHelper::getTableColumns(Common::prefixTable('log_link_visit_action')); $this->assertArrayHasKey('time_spent', $columnn); } - public function test_install_shouldInstallColumn_LogVisit_LastIdlinkVa() + public function testInstallShouldInstallColumnLogVisitLastIdlinkVa() { $columnn = DbHelper::getTableColumns(Common::prefixTable('log_visit')); $this->assertArrayHasKey('last_idlink_va', $columnn); } - public function test_uninstall_shouldRemoveAllInstalledColumns() + public function testUninstallShouldRemoveAllInstalledColumns() { $this->logVisit->uninstall(); $this->logAction->uninstall(); @@ -91,7 +91,7 @@ public function test_uninstall_shouldRemoveAllInstalledColumns() $this->assertSame(0, $this->logConverison->getNumInstalledIndexes()); } - public function test_uninstall_shouldInstallColumn_LogLinkVisitAction_TimeSpent() + public function testUninstallShouldInstallColumnLogLinkVisitActionTimeSpent() { $this->logAction->uninstall(); @@ -99,7 +99,7 @@ public function test_uninstall_shouldInstallColumn_LogLinkVisitAction_TimeSpent( $this->assertArrayNotHasKey('time_spent', $columnn); } - public function test_uninstall_shouldInstallColumn_LogVisit_LastIdlinkVa() + public function testUninstallShouldInstallColumnLogVisitLastIdlinkVa() { $this->logVisit->uninstall(); @@ -107,7 +107,7 @@ public function test_uninstall_shouldInstallColumn_LogVisit_LastIdlinkVa() $this->assertArrayNotHasKey('last_idlink_va', $columnn); } - public function test_install_shouldMakeSureThereAreAtLeast5Installed() + public function testInstallShouldMakeSureThereAreAtLeast5Installed() { $this->logVisit->removeCustomDimension(3); $this->logVisit->removeCustomDimension(4); @@ -122,7 +122,7 @@ public function test_install_shouldMakeSureThereAreAtLeast5Installed() $this->assertSame(array(2,5,6,7,8), $this->logVisit->getInstalledIndexes()); } - public function test_getInstalledIndexes_shouldReturnInstalledIndexes() + public function testGetInstalledIndexesShouldReturnInstalledIndexes() { $expected = range(1, 5); $this->assertSame($expected, $this->logVisit->getInstalledIndexes()); @@ -142,7 +142,7 @@ public function test_getInstalledIndexes_shouldReturnInstalledIndexes() $this->assertSame($expected, $this->logConverison->getInstalledIndexes()); } - public function test_getNumInstalledIndexes_shouldReturnInstalledIndexes() + public function testGetNumInstalledIndexesShouldReturnInstalledIndexes() { $expected = 5; $this->assertSame($expected, $this->logVisit->getNumInstalledIndexes()); @@ -162,7 +162,7 @@ public function test_getNumInstalledIndexes_shouldReturnInstalledIndexes() $this->assertSame($expected, $this->logConverison->getNumInstalledIndexes()); } - public function test_buildCustomDimensionColumnName() + public function testBuildCustomDimensionColumnName() { $this->assertNull(LogTable::buildCustomDimensionColumnName('0')); $this->assertNull(LogTable::buildCustomDimensionColumnName('')); @@ -177,7 +177,7 @@ public function test_buildCustomDimensionColumnName() $this->assertSame('custom_dimension_95', LogTable::buildCustomDimensionColumnName(array('index' => '95'))); } - public function test_removeCustomDimension_shouldRemoveASpecificIndex() + public function testRemoveCustomDimensionShouldRemoveASpecificIndex() { // should remove nothing as not a valid index $this->logVisit->removeCustomDimension(0); @@ -192,7 +192,7 @@ public function test_removeCustomDimension_shouldRemoveASpecificIndex() $this->assertSame(array(2,4,5), $this->logVisit->getInstalledIndexes()); } - public function test_addManyCustomDimensions_shouldAddNewColumns() + public function testAddManyCustomDimensionsShouldAddNewColumns() { // should add nothing as not a valid index $this->logVisit->addManyCustomDimensions(0); @@ -218,7 +218,7 @@ public function test_addManyCustomDimensions_shouldAddNewColumns() /** * @dataProvider getDimensionColumnTestNames */ - public function test_isCustomDimensionColumn($expected, $name) + public function testIsCustomDimensionColumn($expected, $name) { $this->assertSame($expected, LogTable::isCustomDimensionColumn($name)); } diff --git a/plugins/CustomDimensions/tests/Integration/DataTable/Filter/RemoveUserIfNeededTest.php b/plugins/CustomDimensions/tests/Integration/DataTable/Filter/RemoveUserIfNeededTest.php index 6265bb5fdeb..4281fb440fd 100644 --- a/plugins/CustomDimensions/tests/Integration/DataTable/Filter/RemoveUserIfNeededTest.php +++ b/plugins/CustomDimensions/tests/Integration/DataTable/Filter/RemoveUserIfNeededTest.php @@ -33,14 +33,14 @@ public function setUp(): void Fixture::createWebsite('2010-01-01 00:00:00'); } - public function test_filter_shouldNotRemoveColumn_IfThereIsAValueInTableForNbUsers() + public function testFilterShouldNotRemoveColumnIfThereIsAValueInTableForNbUsers() { $columns = $this->filterTable($withUser = 5); $this->assertSame(array(0, false, 5), $columns); } - public function test_filter_withoutUsers_shouldRemoveColumn() + public function testFilterWithoutUsersShouldRemoveColumn() { $columns = $this->filterTable($withUser = 0); $this->assertSame(array(false, false, false), $columns); diff --git a/plugins/CustomDimensions/tests/Integration/Dimension/DimensionTest.php b/plugins/CustomDimensions/tests/Integration/Dimension/DimensionTest.php index 0ae6f3cbfe6..05e62f809b5 100644 --- a/plugins/CustomDimensions/tests/Integration/Dimension/DimensionTest.php +++ b/plugins/CustomDimensions/tests/Integration/Dimension/DimensionTest.php @@ -36,7 +36,7 @@ public function setUp(): void $this->id3 = $this->createIndex(CustomDimensions::SCOPE_ACTION, $index = 1, $active = false); } - public function test_checkExists_shouldNotFailIfDimensionExists() + public function testCheckExistsShouldNotFailIfDimensionExists() { $this->expectNotToPerformAssertions(); $this->getDimension($this->id1, 1)->checkExists(); @@ -44,7 +44,7 @@ public function test_checkExists_shouldNotFailIfDimensionExists() $this->getDimension($this->id3, 1)->checkExists(); } - public function test_checkExists_shouldFailIfDimensionDoesNotExist() + public function testCheckExistsShouldFailIfDimensionDoesNotExist() { $this->expectException(\Exception::class); $this->expectExceptionMessage('CustomDimensions_ExceptionDimensionDoesNotExist'); @@ -52,14 +52,14 @@ public function test_checkExists_shouldFailIfDimensionDoesNotExist() $this->getDimension($this->id1, 2)->checkExists(); } - public function test_checkActive_shouldNotFailIfDimensionExistsAndIsActive() + public function testCheckActiveShouldNotFailIfDimensionExistsAndIsActive() { $this->expectNotToPerformAssertions(); $this->getDimension($this->id1, 1)->checkActive(); $this->getDimension($this->id2, 1)->checkActive(); } - public function test_checkActive_shouldFailIfDimensionExistsButIsNotActive() + public function testCheckActiveShouldFailIfDimensionExistsButIsNotActive() { $this->expectException(\Exception::class); $this->expectExceptionMessage('CustomDimensions_ExceptionDimensionIsNotActive'); @@ -67,7 +67,7 @@ public function test_checkActive_shouldFailIfDimensionExistsButIsNotActive() $this->getDimension($this->id3, 1)->checkActive(); } - public function test_checkActive_shouldFailIfDimensionDoesNotExistAndThereforeIsNotActive() + public function testCheckActiveShouldFailIfDimensionDoesNotExistAndThereforeIsNotActive() { $this->expectException(\Exception::class); $this->expectExceptionMessage('CustomDimensions_ExceptionDimensionDoesNotExist'); diff --git a/plugins/CustomDimensions/tests/Integration/Dimension/ExtractionTest.php b/plugins/CustomDimensions/tests/Integration/Dimension/ExtractionTest.php index 5b91d45e637..f7773ef02c5 100644 --- a/plugins/CustomDimensions/tests/Integration/Dimension/ExtractionTest.php +++ b/plugins/CustomDimensions/tests/Integration/Dimension/ExtractionTest.php @@ -34,7 +34,7 @@ public function setUp(): void } } - public function test_non_capturing_group() + public function testNonCapturingGroup() { $extraction = $this->buildExtraction('url', '.com/(?:test)/.*camelCase=(.*)'); @@ -44,7 +44,7 @@ public function test_non_capturing_group() $this->assertSame('fooBarBaz', $value); } - public function test_non_capturing_group_within_capture_group() + public function testNonCapturingGroupWithinCaptureGroup() { $extraction = $this->buildExtraction('url', '.com/.*(?:camel=|camelCase=(.*))'); @@ -54,7 +54,7 @@ public function test_non_capturing_group_within_capture_group() $this->assertSame('fooBarBaz', $value); } - public function test_multiple_non_capturing_groups() + public function testMultipleNonCapturingGroups() { $extraction = $this->buildExtraction('url', '.com/(?:test)/.*(?:camel=|camelCase=(.*))'); @@ -64,7 +64,7 @@ public function test_multiple_non_capturing_groups() $this->assertSame('fooBarBaz', $value); } - public function test_toArray() + public function testToArray() { $extraction = $this->buildExtraction('url', '.com/(.+)/index'); $value = $extraction->toArray(); @@ -72,7 +72,7 @@ public function test_toArray() $this->assertSame(array('dimension' => 'url', 'pattern' => '.com/(.+)/index'), $value); } - public function test_extract_url_withMatch() + public function testExtractUrlWithMatch() { $extraction = $this->buildExtraction('url', '.com/(.+)/index'); @@ -82,7 +82,7 @@ public function test_extract_url_withMatch() $this->assertSame('test', $value); } - public function test_extract_url_withNoPattern() + public function testExtractUrlWithNoPattern() { $extraction = $this->buildExtraction('url', 'example'); @@ -92,7 +92,7 @@ public function test_extract_url_withNoPattern() $this->assertNull($value); } - public function test_extract_url_withPatternButNoMatch() + public function testExtractUrlWithPatternButNoMatch() { $extraction = $this->buildExtraction('url', 'examplePiwik(.+)'); @@ -102,7 +102,7 @@ public function test_extract_url_withPatternButNoMatch() $this->assertNull($value); } - public function test_actionName_match() + public function testActionNameMatch() { $extraction = $this->buildExtraction('action_name', 'My(.+)Title'); @@ -112,7 +112,7 @@ public function test_actionName_match() $this->assertSame(' Test ', $value); } - public function test_extract_urlparam() + public function testExtractUrlparam() { $request = $this->buildRequest(); @@ -126,7 +126,7 @@ public function test_extract_urlparam() $this->assertNull($value); } - public function test_extract_withAction_shouldReadValueFromAction_NotFromPassedRequest() + public function testExtractWithActionShouldReadValueFromActionNotFromPassedRequest() { $request = $this->buildRequest(); $action = new ActionPageview($request); @@ -145,7 +145,7 @@ public function test_extract_withAction_shouldReadValueFromAction_NotFromPassedR /** * @dataProvider getCaseSensitiveTestProvider */ - public function test_extract_shouldBeCaseSensitiveByDefault($dimension, $pattern, $expectedExtracted) + public function testExtractShouldBeCaseSensitiveByDefault($dimension, $pattern, $expectedExtracted) { $request = $this->buildRequest(); @@ -169,7 +169,7 @@ public function getCaseSensitiveTestProvider() /** * @dataProvider getCaseInsensitiveTestProvider */ - public function test_extract_WhenCaseInsensitiveIsEnabled($dimension, $pattern, $expectedExtracted) + public function testExtractWhenCaseInsensitiveIsEnabled($dimension, $pattern, $expectedExtracted) { $request = $this->buildRequest(); @@ -192,7 +192,7 @@ public function getCaseInsensitiveTestProvider() ); } - public function test_extract_anyRandomTrackingApiParameter() + public function testExtractAnyRandomTrackingApiParameter() { $request = $this->buildRequest(); @@ -200,7 +200,7 @@ public function test_extract_anyRandomTrackingApiParameter() $this->assertSame('errer', $value); } - public function test_extract_whenOnlyPatternGiven() + public function testExtractWhenOnlyPatternGiven() { $request = $this->buildRequest(); @@ -208,7 +208,7 @@ public function test_extract_whenOnlyPatternGiven() $this->assertSame('http://www.example.com/test/index.php?idsite=54&module=CoreHome&action=test&camelCase=fooBarBaz', $value); } - public function test_check_shouldFailWhenInvalidDimensionGiven() + public function testCheckShouldFailWhenInvalidDimensionGiven() { $this->expectException(\Exception::class); $this->expectExceptionMessage('Invald dimension \'anyInvalid\' used in an extraction. Available dimensions are: url, urlparam, action_name'); @@ -216,7 +216,7 @@ public function test_check_shouldFailWhenInvalidDimensionGiven() $this->buildExtraction('anyInvalid', '/ref(.+)')->check(); } - public function test_check_shouldFailWhenInvalidRegGiven() + public function testCheckShouldFailWhenInvalidRegGiven() { $check = '/foo(*)/'; $this->expectException(\Exception::class); @@ -227,7 +227,7 @@ public function test_check_shouldFailWhenInvalidRegGiven() /** * @dataProvider getInvalidPatterns */ - public function test_check_shouldFailWhenInvalidPatternGiven($pattern) + public function testCheckShouldFailWhenInvalidPatternGiven($pattern) { $this->expectException(\Exception::class); $this->expectExceptionMessage('You need to group exactly one part of the regular expression inside round brackets, eg \'index_(.+).html\''); @@ -235,7 +235,7 @@ public function test_check_shouldFailWhenInvalidPatternGiven($pattern) $this->buildExtraction('url', $pattern)->check(); } - public function test_check_shouldNotFailWhenValidCombinationsAreGiven() + public function testCheckShouldNotFailWhenValidCombinationsAreGiven() { $this->expectNotToPerformAssertions(); $this->buildExtraction('urlparam', 'index')->check(); // does not have to contain brackets diff --git a/plugins/CustomDimensions/tests/Integration/Dimension/IndexTest.php b/plugins/CustomDimensions/tests/Integration/Dimension/IndexTest.php index d411ceeaac9..2799e510b7c 100644 --- a/plugins/CustomDimensions/tests/Integration/Dimension/IndexTest.php +++ b/plugins/CustomDimensions/tests/Integration/Dimension/IndexTest.php @@ -40,12 +40,12 @@ public function setUp(): void $this->index = new Index(); } - public function test_shouldReturn1_WhenNoIndexIsUsedYet() + public function testShouldReturn1WhenNoIndexIsUsedYet() { $this->assertSame(1, $this->index->getNextIndex($idSite = 1, CustomDimensions::SCOPE_ACTION)); } - public function test_shouldNotActuallyCreateAnIndex_OnlyReturnNextFreeIndex() + public function testShouldNotActuallyCreateAnIndexOnlyReturnNextFreeIndex() { $idSite = 1; $scope = CustomDimensions::SCOPE_ACTION; @@ -54,7 +54,7 @@ public function test_shouldNotActuallyCreateAnIndex_OnlyReturnNextFreeIndex() $this->assertSame(1, $this->index->getNextIndex($idSite, $scope)); } - public function test_shouldReturnNextFreeIndex() + public function testShouldReturnNextFreeIndex() { $idSite = 1; @@ -69,7 +69,7 @@ public function test_shouldReturnNextFreeIndex() $this->assertSame(2, $this->index->getNextIndex($idSite, CustomDimensions::SCOPE_ACTION)); // should remain unchanged } - public function test_shouldThrowAnException_IfAllIndexesAreUsed() + public function testShouldThrowAnExceptionIfAllIndexesAreUsed() { $this->expectException(\Exception::class); $this->expectExceptionMessage('All Custom Dimensions for website 1 in scope \'action\' are already used'); diff --git a/plugins/CustomDimensions/tests/Integration/SegmentTest.php b/plugins/CustomDimensions/tests/Integration/SegmentTest.php index 7baeb719c86..03e6611ada4 100644 --- a/plugins/CustomDimensions/tests/Integration/SegmentTest.php +++ b/plugins/CustomDimensions/tests/Integration/SegmentTest.php @@ -24,7 +24,7 @@ public function setUp(): void API::getInstance()->configureNewCustomDimension($idSite, 'test dim', 'visit', 1); } - public function test_Segment_CanSeeCustomDimensionSegments() + public function testSegmentCanSeeCustomDimensionSegments() { $select = 'log_visit.idvisit'; $from = 'log_visit'; diff --git a/plugins/CustomDimensions/tests/Integration/Tracker/CustomDimensionsRequestProcessorTest.php b/plugins/CustomDimensions/tests/Integration/Tracker/CustomDimensionsRequestProcessorTest.php index ad6f26aee82..9d31d57ce65 100644 --- a/plugins/CustomDimensions/tests/Integration/Tracker/CustomDimensionsRequestProcessorTest.php +++ b/plugins/CustomDimensions/tests/Integration/Tracker/CustomDimensionsRequestProcessorTest.php @@ -57,7 +57,7 @@ public function tearDown(): void parent::tearDown(); } - public function test_buildCustomDimensionTrackingApiName() + public function testBuildCustomDimensionTrackingApiName() { $this->assertNull(Processor::buildCustomDimensionTrackingApiName('')); $this->assertNull(Processor::buildCustomDimensionTrackingApiName('0')); @@ -70,7 +70,7 @@ public function test_buildCustomDimensionTrackingApiName() $this->assertSame('dimension4', Processor::buildCustomDimensionTrackingApiName(array('idcustomdimension' => '4'))); } - public function test_getCachedCustomDimensionIndexes() + public function testGetCachedCustomDimensionIndexes() { $logTable = new LogTable(CustomDimensions::SCOPE_ACTION); $logTable->removeCustomDimension(1); @@ -82,7 +82,7 @@ public function test_getCachedCustomDimensionIndexes() $this->assertSame(range(2, 5), $indexes); } - public function test_getCachedCustomDimensions_shouldReturnDimensionsForSiteButOnlyActiveOnes() + public function testGetCachedCustomDimensionsShouldReturnDimensionsForSiteButOnlyActiveOnes() { $this->configureSomeDimensions(); @@ -102,7 +102,7 @@ public function test_getCachedCustomDimensions_shouldReturnDimensionsForSiteButO $this->assertCount(1, $dimensions); } - public function test_hasActionCustomDimensionConfiguredInSite_whenHasActionDimensionConfigured() + public function testHasActionCustomDimensionConfiguredInSiteWhenHasActionDimensionConfigured() { $this->configureSomeDimensions(); @@ -110,19 +110,19 @@ public function test_hasActionCustomDimensionConfiguredInSite_whenHasActionDimen $this->assertTrue(Processor::hasActionCustomDimensionConfiguredInSite($request)); } - public function test_hasActionCustomDimensionConfiguredInSite_whenHasOnlyVisitDimensions() + public function testHasActionCustomDimensionConfiguredInSiteWhenHasOnlyVisitDimensions() { $request = new Request(array('idsite' => 2)); $this->assertFalse(Processor::hasActionCustomDimensionConfiguredInSite($request)); } - public function test_hasActionCustomDimensionConfiguredInSite_WhenNoDimensionsAreConfgigured() + public function testHasActionCustomDimensionConfiguredInSiteWhenNoDimensionsAreConfgigured() { $request = new Request(array('idsite' => 1)); $this->assertFalse(Processor::hasActionCustomDimensionConfiguredInSite($request)); } - public function test_onExistingVisit_ShouldOnlyAddColumnsOfCustomDimensionsInScopeVisit() + public function testOnExistingVisitShouldOnlyAddColumnsOfCustomDimensionsInScopeVisit() { $this->configureSomeDimensions(); @@ -149,7 +149,7 @@ public function test_onExistingVisit_ShouldOnlyAddColumnsOfCustomDimensionsInSco $this->assertSame($expected, $valuesToUpdate); } - public function test_onNewVisit_afterRequestProcessed_ShouldSaveManuallySetDimensionValues_ForActivatedDimensions() + public function testOnNewVisitAfterRequestProcessedShouldSaveManuallySetDimensionValuesForActivatedDimensions() { $this->configureSomeDimensions(); @@ -192,7 +192,7 @@ public function test_onNewVisit_afterRequestProcessed_ShouldSaveManuallySetDimen $this->assertSame($expected1, $visitProperties->getProperties()); } - public function test_afterRequestProcessed_ShouldSaveManuallySetDimensionValues_ForActivatedDimensions() + public function testAfterRequestProcessedShouldSaveManuallySetDimensionValuesForActivatedDimensions() { $this->configureSomeDimensions(); @@ -232,7 +232,7 @@ public function test_afterRequestProcessed_ShouldSaveManuallySetDimensionValues_ $this->assertSame($expected1, $visitProperties->getProperties()); // should not have added visit dimensions } - public function test_onNewVisit_afterRequestProcessed_NoDimensionsConfigured_ShouldSaveNothing() + public function testOnNewVisitAfterRequestProcessedNoDimensionsConfiguredShouldSaveNothing() { $visitProperties = new VisitProperties(); $request = new Request(array( @@ -250,7 +250,7 @@ public function test_onNewVisit_afterRequestProcessed_NoDimensionsConfigured_Sho $this->assertSame(array(), $visitProperties->getProperties()); } - public function test_onNewVisit_afterRequestProcessed_NoActionSet_ShouldNotFailIfThereIsNoActionSet() + public function testOnNewVisitAfterRequestProcessedNoActionSetShouldNotFailIfThereIsNoActionSet() { $this->configureSomeDimensions(); @@ -274,7 +274,7 @@ public function test_onNewVisit_afterRequestProcessed_NoActionSet_ShouldNotFailI $this->assertSame($expected, $visitProperties->getProperties()); } - public function test_afterRequestProcessed_NoActionSet_ShouldNotSaveAnEmptyValue() + public function testAfterRequestProcessedNoActionSetShouldNotSaveAnEmptyValue() { $this->configureSomeDimensions(); @@ -294,7 +294,7 @@ public function test_afterRequestProcessed_NoActionSet_ShouldNotSaveAnEmptyValue $this->assertSame(array('custom_dimension_4' => ''), $visitProperties->getProperties()); } - public function test_afterRequestProcessed_NoActionSet_ShouldBeAbleToExtractAValue() + public function testAfterRequestProcessedNoActionSetShouldBeAbleToExtractAValue() { $configuration = new Configuration(); $extractions = array( @@ -334,7 +334,7 @@ public function test_afterRequestProcessed_NoActionSet_ShouldBeAbleToExtractAVal $this->assertSame(array('custom_dimension_1' => '11'), $action->getCustomFields()); } - public function test_afterRequestProcessed_NoActionSet_ShouldBeAbleToHandleCaseSensitive() + public function testAfterRequestProcessedNoActionSetShouldBeAbleToHandleCaseSensitive() { $configuration = new Configuration(); $extractions = array( @@ -354,7 +354,7 @@ public function test_afterRequestProcessed_NoActionSet_ShouldBeAbleToHandleCaseS ), $action->getCustomFields()); } - public function test_valueWithWhitespace_isTrimmed() + public function testValueWithWhitespaceIsTrimmed() { $this->configureSomeDimensions(); @@ -377,7 +377,7 @@ public function test_valueWithWhitespace_isTrimmed() $this->assertSame(array(), $action->getCustomFields()); } - public function test_veryLongValue_isTruncated() + public function testVeryLongValueIsTruncated() { $this->configureSomeDimensions(); @@ -403,7 +403,7 @@ public function test_veryLongValue_isTruncated() $this->assertSame(array(), $action->getCustomFields()); } - public function test_valueWithWhitespace_isTrimmed_extractedFromUrl() + public function testValueWithWhitespaceIsTrimmedExtractedFromUrl() { $configuration = new Configuration(); $extractions = array( @@ -430,7 +430,7 @@ public function test_valueWithWhitespace_isTrimmed_extractedFromUrl() ), $visitProperties->getProperties()); } - public function test_veryLongValue_isTrimmed_extractedFromUrl() + public function testVeryLongValueIsTrimmedExtractedFromUrl() { $veryLongStr = '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; $trimmedStr = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; diff --git a/plugins/CustomDimensions/tests/System/AutoSuggestTest.php b/plugins/CustomDimensions/tests/System/AutoSuggestTest.php index 0e92ef3e456..93ddc3935c8 100644 --- a/plugins/CustomDimensions/tests/System/AutoSuggestTest.php +++ b/plugins/CustomDimensions/tests/System/AutoSuggestTest.php @@ -65,28 +65,28 @@ public function getApiForTesting() return $apiToTest; } - public function test_getMostUsedActionDimensionValues_shouldReturnMostUsedValues() + public function testGetMostUsedActionDimensionValuesShouldReturnMostUsedValues() { $autoSuggest = new AutoSuggest(); $values = $autoSuggest->getMostUsedActionDimensionValues(array('idcustomdimension' => 3), $idSite = 1, $limit = 60); $this->assertEquals(array('en', 'value3', 'value5 3'), $values); } - public function test_getMostUsedActionDimensionValues_shouldApplyLimit() + public function testGetMostUsedActionDimensionValuesShouldApplyLimit() { $autoSuggest = new AutoSuggest(); $values = $autoSuggest->getMostUsedActionDimensionValues(array('idcustomdimension' => 3), $idSite = 1, $limit = 2); $this->assertEquals(array('en','value3'), $values); } - public function test_getMostUsedActionDimensionValues_shouldApplyIdSite() + public function testGetMostUsedActionDimensionValuesShouldApplyIdSite() { $autoSuggest = new AutoSuggest(); $values = $autoSuggest->getMostUsedActionDimensionValues(array('idcustomdimension' => 1), $idSite = 2, $limit = 2); $this->assertEquals(array('site2 value1'), $values); } - public function test_getMostUsedActionDimensionValues_shouldApplyIndex() + public function testGetMostUsedActionDimensionValuesShouldApplyIndex() { $autoSuggest = new AutoSuggest(); $values = $autoSuggest->getMostUsedActionDimensionValues(array('idcustomdimension' => 5), $idSite = 1, $limit = 10); diff --git a/plugins/CustomDimensions/tests/Unit/DataTable/Filter/AddSegmentMetadataTest.php b/plugins/CustomDimensions/tests/Unit/DataTable/Filter/AddSegmentMetadataTest.php index 1f2bf2a4487..f49d4dc35c3 100644 --- a/plugins/CustomDimensions/tests/Unit/DataTable/Filter/AddSegmentMetadataTest.php +++ b/plugins/CustomDimensions/tests/Unit/DataTable/Filter/AddSegmentMetadataTest.php @@ -23,7 +23,7 @@ class AddSegmentMetadataTest extends \PHPUnit\Framework\TestCase { private $filter = 'Piwik\Plugins\CustomDimensions\DataTable\Filter\AddSegmentMetadata'; - public function test_filter() + public function testFilter() { $dataTable = new DataTable(); $dataTable->addRowsFromArray(array( diff --git a/plugins/CustomDimensions/tests/Unit/Dimension/ActiveTest.php b/plugins/CustomDimensions/tests/Unit/Dimension/ActiveTest.php index 412b0325c0e..1036b286801 100644 --- a/plugins/CustomDimensions/tests/Unit/Dimension/ActiveTest.php +++ b/plugins/CustomDimensions/tests/Unit/Dimension/ActiveTest.php @@ -19,7 +19,7 @@ */ class ActiveTest extends \PHPUnit\Framework\TestCase { - public function test_check_shouldFailWhenActiveIsEmpty() + public function testCheckShouldFailWhenActiveIsEmpty() { $this->expectException(\Exception::class); $this->expectExceptionMessage("Invalid value '' for 'active' specified. Allowed values: '0' or '1'"); @@ -27,7 +27,7 @@ public function test_check_shouldFailWhenActiveIsEmpty() $this->buildActive('')->check(); } - public function test_check_shouldFailWhenActiveIsNotValid() + public function testCheckShouldFailWhenActiveIsNotValid() { $this->expectException(\Exception::class); $this->expectExceptionMessage("Invalid value 'anyValUe' for 'active' specified. Allowed values: '0' or '1'"); @@ -35,7 +35,7 @@ public function test_check_shouldFailWhenActiveIsNotValid() $this->buildActive('anyValUe')->check(); } - public function test_check_shouldFailWhenActiveIsNumericButNot0or1() + public function testCheckShouldFailWhenActiveIsNumericButNot0or1() { $this->expectException(\Exception::class); $this->expectExceptionMessage("Invalid value '2'"); @@ -43,7 +43,7 @@ public function test_check_shouldFailWhenActiveIsNumericButNot0or1() $this->buildActive('2')->check(); } - public function test_check_shouldNotFailWhenActiveIsValid() + public function testCheckShouldNotFailWhenActiveIsValid() { self::expectNotToPerformAssertions(); diff --git a/plugins/CustomDimensions/tests/Unit/Dimension/CaseSensitiveTest.php b/plugins/CustomDimensions/tests/Unit/Dimension/CaseSensitiveTest.php index b7ed9132563..9e3ca89eb6b 100644 --- a/plugins/CustomDimensions/tests/Unit/Dimension/CaseSensitiveTest.php +++ b/plugins/CustomDimensions/tests/Unit/Dimension/CaseSensitiveTest.php @@ -19,28 +19,28 @@ */ class CaseSensitiveTest extends \PHPUnit\Framework\TestCase { - public function test_check_shouldFailWhenActiveIsEmpty() + public function testCheckShouldFailWhenActiveIsEmpty() { $this->expectException(\Exception::class); $this->expectExceptionMessage("Invalid value '' for 'caseSensitive' specified. Allowed values: '0' or '1'"); $this->buildCaseSensitive('')->check(); } - public function test_check_shouldFailWhenActiveIsNotValid() + public function testCheckShouldFailWhenActiveIsNotValid() { $this->expectException(\Exception::class); $this->expectExceptionMessage("Invalid value 'anyValUe' for 'caseSensitive' specified. Allowed values: '0' or '1'"); $this->buildCaseSensitive('anyValUe')->check(); } - public function test_check_shouldFailWhenActiveIsNumericButNot0or1() + public function testCheckShouldFailWhenActiveIsNumericButNot0or1() { $this->expectException(\Exception::class); $this->expectExceptionMessage("Invalid value '2'"); $this->buildCaseSensitive('2')->check(); } - public function test_check_shouldNotFailWhenActiveIsValid() + public function testCheckShouldNotFailWhenActiveIsValid() { self::expectNotToPerformAssertions(); diff --git a/plugins/CustomDimensions/tests/Unit/Dimension/ExtractionsTest.php b/plugins/CustomDimensions/tests/Unit/Dimension/ExtractionsTest.php index 032c22234a3..a5e42699f74 100644 --- a/plugins/CustomDimensions/tests/Unit/Dimension/ExtractionsTest.php +++ b/plugins/CustomDimensions/tests/Unit/Dimension/ExtractionsTest.php @@ -19,7 +19,7 @@ */ class ExtractionsTest extends \PHPUnit\Framework\TestCase { - public function test_check_shouldFailWhenExtractionsIsNotAnArray() + public function testCheckShouldFailWhenExtractionsIsNotAnArray() { $this->expectException(\Exception::class); $this->expectExceptionMessage("extractions has to be an array"); @@ -27,7 +27,7 @@ public function test_check_shouldFailWhenExtractionsIsNotAnArray() $this->buildExtractions('')->check(); } - public function test_check_shouldFailWhenExtractionsDoesNotContainArrays() + public function testCheckShouldFailWhenExtractionsDoesNotContainArrays() { $this->expectException(\Exception::class); $this->expectExceptionMessage("Each extraction within extractions has to be an array"); @@ -38,7 +38,7 @@ public function test_check_shouldFailWhenExtractionsDoesNotContainArrays() /** * @dataProvider getInvalidExtraction */ - public function test_check_shouldFailWhenExtractionsDoesNotContainValidExtraction($extraction) + public function testCheckShouldFailWhenExtractionsDoesNotContainValidExtraction($extraction) { $this->expectException(\Exception::class); $this->expectExceptionMessage('Each extraction within extractions must have a key "dimension" and "pattern" only'); @@ -57,7 +57,7 @@ public function getInvalidExtraction() ); } - public function test_check_shouldAlsoCheckExtractionAndFailIfValueIsInvalid() + public function testCheckShouldAlsoCheckExtractionAndFailIfValueIsInvalid() { $this->expectException(\Exception::class); $this->expectExceptionMessage("Invald dimension 'invalId' used in an extraction. Available dimensions are: url, urlparam, action_name"); @@ -67,7 +67,7 @@ public function test_check_shouldAlsoCheckExtractionAndFailIfValueIsInvalid() $this->buildExtractions(array($extraction1, $extraction2))->check(); } - public function test_check_shouldNotFailWhenExtractionsDefinitionIsValid() + public function testCheckShouldNotFailWhenExtractionsDefinitionIsValid() { $extraction1 = array('dimension' => 'url', 'pattern' => 'index(.+).html'); $extraction2 = array('dimension' => 'urlparam', 'pattern' => 'index'); diff --git a/plugins/CustomDimensions/tests/Unit/Dimension/NameTest.php b/plugins/CustomDimensions/tests/Unit/Dimension/NameTest.php index 23160e2c9b2..6169b496124 100644 --- a/plugins/CustomDimensions/tests/Unit/Dimension/NameTest.php +++ b/plugins/CustomDimensions/tests/Unit/Dimension/NameTest.php @@ -25,7 +25,7 @@ public function setUp(): void Fixture::resetTranslations(); } - public function test_check_shouldFailWhenNameIsEmpty() + public function testCheckShouldFailWhenNameIsEmpty() { $this->expectException(\Exception::class); $this->expectExceptionMessage('CustomDimensions_NameIsRequired'); @@ -36,7 +36,7 @@ public function test_check_shouldFailWhenNameIsEmpty() /** * @dataProvider getInvalidNames */ - public function test_check_shouldFailWhenNameIsInvalid($name) + public function testCheckShouldFailWhenNameIsInvalid($name) { $this->expectException(\Exception::class); $this->expectExceptionMessage('CustomDimensions_NameAllowedCharacters'); @@ -44,7 +44,7 @@ public function test_check_shouldFailWhenNameIsInvalid($name) $this->buildName($name)->check(); } - public function test_check_shouldFailWhenNameIsTooLong() + public function testCheckShouldFailWhenNameIsTooLong() { $this->expectException(\Exception::class); $this->expectExceptionMessage('CustomDimensions_NameIsTooLong'); @@ -72,7 +72,7 @@ public function getInvalidNames() /** * @dataProvider getValidNames */ - public function test_check_shouldNotFailWhenScopeIsValid($name) + public function testCheckShouldNotFailWhenScopeIsValid($name) { self::expectNotToPerformAssertions(); diff --git a/plugins/CustomDimensions/tests/Unit/Dimension/ScopeTest.php b/plugins/CustomDimensions/tests/Unit/Dimension/ScopeTest.php index 5eac05a4ffa..098fe4550a6 100644 --- a/plugins/CustomDimensions/tests/Unit/Dimension/ScopeTest.php +++ b/plugins/CustomDimensions/tests/Unit/Dimension/ScopeTest.php @@ -19,7 +19,7 @@ */ class ScopeTest extends \PHPUnit\Framework\TestCase { - public function test_check_shouldFailWhenScopeIsEmpty() + public function testCheckShouldFailWhenScopeIsEmpty() { $this->expectException(\Exception::class); $this->expectExceptionMessage("Invalid value '' for 'scope' specified. Available scopes are: visit, action, conversion"); @@ -27,7 +27,7 @@ public function test_check_shouldFailWhenScopeIsEmpty() $this->buildScope('')->check(); } - public function test_check_shouldFailWhenScopeIsNotValid() + public function testCheckShouldFailWhenScopeIsNotValid() { $this->expectException(\Exception::class); $this->expectExceptionMessage("Invalid value 'anyScoPe' for 'scope' specified. Available scopes are: visit, action, conversion"); @@ -35,7 +35,7 @@ public function test_check_shouldFailWhenScopeIsNotValid() $this->buildScope('anyScoPe')->check(); } - public function test_check_shouldNotFailWhenScopeIsValid() + public function testCheckShouldNotFailWhenScopeIsValid() { self::expectNotToPerformAssertions(); diff --git a/plugins/CustomJsTracker/tests/Integration/ApiTest.php b/plugins/CustomJsTracker/tests/Integration/ApiTest.php index a69ab081820..cba17d6716b 100644 --- a/plugins/CustomJsTracker/tests/Integration/ApiTest.php +++ b/plugins/CustomJsTracker/tests/Integration/ApiTest.php @@ -36,7 +36,7 @@ public function setUp(): void $this->api = API::getInstance(); } - public function test_doesIncludePluginTrackersAutomatically_failsIfNotEnoughPermission() + public function testDoesIncludePluginTrackersAutomaticallyFailsIfNotEnoughPermission() { $this->expectException(\Piwik\NoAccessException::class); $this->expectExceptionMessage('checkUserHasSomeAdminAccess'); @@ -45,7 +45,7 @@ public function test_doesIncludePluginTrackersAutomatically_failsIfNotEnoughPerm $this->api->doesIncludePluginTrackersAutomatically(); } - public function test_doesIncludePluginTrackersAutomatically_failsIfNotEnoughPermissionAnonymous() + public function testDoesIncludePluginTrackersAutomaticallyFailsIfNotEnoughPermissionAnonymous() { $this->expectException(\Piwik\NoAccessException::class); $this->expectExceptionMessage('checkUserHasSomeAdminAccess'); @@ -54,7 +54,7 @@ public function test_doesIncludePluginTrackersAutomatically_failsIfNotEnoughPerm $this->api->doesIncludePluginTrackersAutomatically(); } - public function test_doesIncludePluginTrackersAutomatically_returnsValueWhenEnoughPermission() + public function testDoesIncludePluginTrackersAutomaticallyReturnsValueWhenEnoughPermission() { $this->assertTrue($this->api->doesIncludePluginTrackersAutomatically()); } diff --git a/plugins/CustomJsTracker/tests/Integration/FileTest.php b/plugins/CustomJsTracker/tests/Integration/FileTest.php index b2345314d6c..b12ec881b6f 100644 --- a/plugins/CustomJsTracker/tests/Integration/FileTest.php +++ b/plugins/CustomJsTracker/tests/Integration/FileTest.php @@ -84,26 +84,26 @@ private function makeNotWritableFile() private function makeNotReadableFile() { - return $this->makeNotReadableFile_inWritableDirectory(); + return $this->makeNotReadableFileInWritableDirectory(); } - private function makeNotReadableFile_inNonWritableDirectory() + private function makeNotReadableFileInNonWritableDirectory() { return $this->makeFile(self::NOT_EXISTING_FILE_IN_NON_WRITABLE_DIRECTORY); } - private function makeNotReadableFile_inWritableDirectory() + private function makeNotReadableFileInWritableDirectory() { return $this->makeFile(self::NOT_EXISTING_FILE_IN_WRITABLE_DIRECTORY); } - public function test_getName() + public function testGetName() { $this->assertSame('test.js', $this->makeFile()->getName()); $this->assertSame('notExisTinGFile.js', $this->makeNotReadableFile()->getName()); } - public function test_setFile_createsNewObjectLeavesOldUnchanged() + public function testSetFileCreatesNewObjectLeavesOldUnchanged() { $file = $this->makeFile(); $file2 = $file->setFile('foo/bar.png'); @@ -111,51 +111,51 @@ public function test_setFile_createsNewObjectLeavesOldUnchanged() $this->assertSame('bar.png', $file2->getName()); } - public function test_setFile_returnsObjectOfSameType() + public function testSetFileReturnsObjectOfSameType() { $file = new CustomTestFile('foo/baz.png'); $file2 = $file->setFile('foo/bar.png'); $this->assertTrue($file2 instanceof CustomTestFile); } - public function test_getPath() + public function testGetPath() { $this->assertSame($this->dir . 'notExisTinGFile.js', $this->makeNotReadableFile()->getPath()); } - public function test_hasReadAccess() + public function testHasReadAccess() { $this->assertTrue($this->makeFile()->hasReadAccess()); $this->assertFalse($this->makeNotReadableFile()->hasReadAccess()); } - public function test_hasWriteAccess() + public function testHasWriteAccess() { $this->assertTrue($this->makeFile()->hasWriteAccess()); - $this->assertTrue($this->makeNotReadableFile_inWritableDirectory()->hasWriteAccess()); - $this->assertFalse($this->makeNotReadableFile_inNonWritableDirectory()->hasWriteAccess()); + $this->assertTrue($this->makeNotReadableFileInWritableDirectory()->hasWriteAccess()); + $this->assertFalse($this->makeNotReadableFileInNonWritableDirectory()->hasWriteAccess()); } - public function test_hasWriteAccess_whenFileExistAndIsNotWritable() + public function testHasWriteAccessWhenFileExistAndIsNotWritable() { $this->assertFalse($this->makeNotWritableFile()->hasWriteAccess()); } - public function test_checkReadable_shouldNotThrowException_IfIsReadable() + public function testCheckReadableShouldNotThrowExceptionIfIsReadable() { self::expectNotToPerformAssertions(); $this->makeFile()->checkReadable(); } - public function test_checkWritable_shouldNotThrowException_IfIsWritable() + public function testCheckWritableShouldNotThrowExceptionIfIsWritable() { self::expectNotToPerformAssertions(); $this->makeFile()->checkWritable(); } - public function test_checkReadable_shouldThrowException_IfNotIsReadable() + public function testCheckReadableShouldThrowExceptionIfNotIsReadable() { $this->expectException(\Piwik\Plugins\CustomJsTracker\Exception\AccessDeniedException::class); $this->expectExceptionMessage('not readable'); @@ -163,26 +163,26 @@ public function test_checkReadable_shouldThrowException_IfNotIsReadable() $this->makeNotReadableFile()->checkReadable(); } - public function test_checkWritable_shouldThrowException_IfNotIsWritable() + public function testCheckWritableShouldThrowExceptionIfNotIsWritable() { $this->expectException(\Piwik\Plugins\CustomJsTracker\Exception\AccessDeniedException::class); $this->expectExceptionMessage('not writable'); - $this->makeNotReadableFile_inNonWritableDirectory()->checkWritable(); + $this->makeNotReadableFileInNonWritableDirectory()->checkWritable(); } - public function test_checkWritable_shouldNotThrowException_IfDirectoryIsWritable() + public function testCheckWritableShouldNotThrowExceptionIfDirectoryIsWritable() { $this->expectNotToPerformAssertions(); - $this->makeNotReadableFile_inWritableDirectory()->checkWritable(); + $this->makeNotReadableFileInWritableDirectory()->checkWritable(); } - public function test_getContent() + public function testGetContent() { $this->assertSame("// Hello world\nvar fooBar = 'test';", $this->makeFile()->getContent()); } - public function test_isFileContentSame() + public function testIsFileContentSame() { $this->assertTrue($this->makeFile()->isFileContentSame("// Hello world\nvar fooBar = 'test';")); $this->assertFalse($this->makeFile()->isFileContentSame("// Hello world\nvar foBar = 'test';")); @@ -190,14 +190,14 @@ public function test_isFileContentSame() $this->assertFalse($this->makeFile()->isFileContentSame("Hello world\nvar foBar = 'test'")); } - public function test_getContent_returnsNull_IfFileIsNotReadableOrNotExists() + public function testGetContentReturnsNullIfFileIsNotReadableOrNotExists() { $this->assertNull($this->makeNotReadableFile()->getContent()); } - public function test_save() + public function testSave() { - $notExistingFile = $this->makeNotReadableFile_inWritableDirectory(); + $notExistingFile = $this->makeNotReadableFileInWritableDirectory(); $this->assertFalse($notExistingFile->hasReadAccess()); $this->assertTrue($notExistingFile->hasWriteAccess()); diff --git a/plugins/CustomJsTracker/tests/Integration/PiwikJsManipulatorTest.php b/plugins/CustomJsTracker/tests/Integration/PiwikJsManipulatorTest.php index db7e8afb7fd..660bceb1ea5 100644 --- a/plugins/CustomJsTracker/tests/Integration/PiwikJsManipulatorTest.php +++ b/plugins/CustomJsTracker/tests/Integration/PiwikJsManipulatorTest.php @@ -27,7 +27,7 @@ class PiwikJsManipulatorTest extends IntegrationTestCase var myArray = []; '; - public function test_manipulateContent_shouldAddCodeOfTrackerPlugins() + public function testManipulateContentShouldAddCodeOfTrackerPlugins() { $manipulator = $this->makeManipulator(array( '/plugins/CustomJsTracker/tests/resources/tracker.js', @@ -57,7 +57,7 @@ public function test_manipulateContent_shouldAddCodeOfTrackerPlugins() ', $updatedContent); } - public function test_manipulateContent_shouldNotAddCodeOfTrackerPlugins_IfThereAreNoTrackerFiles() + public function testManipulateContentShouldNotAddCodeOfTrackerPluginsIfThereAreNoTrackerFiles() { $manipulator = $this->makeManipulator(array()); diff --git a/plugins/CustomJsTracker/tests/Integration/PluginTrackerFilesTest.php b/plugins/CustomJsTracker/tests/Integration/PluginTrackerFilesTest.php index 9cddbb6717c..7cda7d89ccb 100644 --- a/plugins/CustomJsTracker/tests/Integration/PluginTrackerFilesTest.php +++ b/plugins/CustomJsTracker/tests/Integration/PluginTrackerFilesTest.php @@ -31,7 +31,7 @@ protected function getDirectoriesToLook() */ class PluginTrackerFilesTest extends IntegrationTestCase { - public function test_find_ifAPluginDefinesAMinifiedAndARegularTrackerItShouldPreferTheMinifiedVersion() + public function testFindIfAPluginDefinesAMinifiedAndARegularTrackerItShouldPreferTheMinifiedVersion() { $trackerFiles = new CustomPluginTrackerFiles(); $foundFiles = $trackerFiles->find(); @@ -41,7 +41,7 @@ public function test_find_ifAPluginDefinesAMinifiedAndARegularTrackerItShouldPre $this->assertEquals('tracker.min.js', $foundFiles['CustomJsTracker']->getName()); } - public function test_find_shouldIgnoreMinifiedVersion_IfRequested() + public function testFindShouldIgnoreMinifiedVersionIfRequested() { $trackerFiles = new CustomPluginTrackerFiles(); $trackerFiles->ignoreMinified(); @@ -52,7 +52,7 @@ public function test_find_shouldIgnoreMinifiedVersion_IfRequested() $this->assertEquals('tracker.js', $foundFiles['CustomJsTracker']->getName()); } - public function test_find_EventsCanIgnoreFiles() + public function testFindEventsCanIgnoreFiles() { $trackerFiles = new CustomPluginTrackerFiles(); $foundFiles = $trackerFiles->find(); diff --git a/plugins/CustomJsTracker/tests/Integration/TrackerUpdaterTest.php b/plugins/CustomJsTracker/tests/Integration/TrackerUpdaterTest.php index e01972759f1..f51d032cff8 100644 --- a/plugins/CustomJsTracker/tests/Integration/TrackerUpdaterTest.php +++ b/plugins/CustomJsTracker/tests/Integration/TrackerUpdaterTest.php @@ -59,7 +59,7 @@ private function makeUpdater($from = null, $to = null) return new TrackerUpdater($from, $to); } - public function test_construct_setsDefaults() + public function testConstructSetsDefaults() { $updater = $this->makeUpdater(); $fromFile = $updater->getFromFile(); @@ -71,7 +71,7 @@ public function test_construct_setsDefaults() $this->assertSame(basename(TrackerUpdater::TARGET_MATOMO_JS), $toFile->getName()); } - public function test_setFormFile_getFromFile() + public function testSetFormFileGetFromFile() { $updater = $this->makeUpdater(); $testFile = new File('foobar'); @@ -80,7 +80,7 @@ public function test_setFormFile_getFromFile() $this->assertSame($testFile, $updater->getFromFile()); } - public function test_setFormFile_CanBeString() + public function testSetFormFileCanBeString() { $updater = $this->makeUpdater(); $updater->setFromFile('foobar'); @@ -88,7 +88,7 @@ public function test_setFormFile_CanBeString() $this->assertSame('foobar', $updater->getFromFile()->getName()); } - public function test_setToFile_getToFile() + public function testSetToFileGetToFile() { $updater = $this->makeUpdater(); $testFile = new File('foobar'); @@ -97,7 +97,7 @@ public function test_setToFile_getToFile() $this->assertSame($testFile, $updater->getToFile()); } - public function test_setToFile_CanBeString() + public function testSetToFileCanBeString() { $updater = $this->makeUpdater(); $updater->setToFile('foobar'); @@ -105,7 +105,7 @@ public function test_setToFile_CanBeString() $this->assertSame('foobar', $updater->getToFile()->getName()); } - public function test_checkWillSucceed_shouldNotThrowExceptionIfPiwikJsTargetIsWritable() + public function testCheckWillSucceedShouldNotThrowExceptionIfPiwikJsTargetIsWritable() { self::expectNotToPerformAssertions(); @@ -113,7 +113,7 @@ public function test_checkWillSucceed_shouldNotThrowExceptionIfPiwikJsTargetIsWr $updater->checkWillSucceed(); } - public function test_checkWillSucceed_shouldNotThrowExceptionIfTargetIsNotWritable() + public function testCheckWillSucceedShouldNotThrowExceptionIfTargetIsNotWritable() { $this->expectException(\Piwik\Plugins\CustomJsTracker\Exception\AccessDeniedException::class); $this->expectExceptionMessage('not writable'); @@ -122,14 +122,14 @@ public function test_checkWillSucceed_shouldNotThrowExceptionIfTargetIsNotWritab $updater->checkWillSucceed(); } - public function test_checkWillSucceed_shouldNotThrowExceptionIfTargetIsWritable() + public function testCheckWillSucceedShouldNotThrowExceptionIfTargetIsWritable() { $this->expectNotToPerformAssertions(); $updater = $this->makeUpdater(null, $this->dir . 'MyNotExisIngFilessss.js'); $updater->checkWillSucceed(); } - public function test_getCurrentTrackerFileContent() + public function testGetCurrentTrackerFileContent() { $targetFile = $this->dir . 'testpiwik.js'; @@ -139,7 +139,7 @@ public function test_getCurrentTrackerFileContent() $this->assertSame(file_get_contents($targetFile), $content); } - public function test_getUpdatedTrackerFileContent_returnsGeneratedPiwikJsWithMergedTrackerFiles_WhenTheyExist() + public function testGetUpdatedTrackerFileContentReturnsGeneratedPiwikJsWithMergedTrackerFilesWhenTheyExist() { $source = $this->dir . 'testpiwik.js'; $target = $this->dir . 'MyTestTarget.js'; @@ -169,7 +169,7 @@ public function test_getUpdatedTrackerFileContent_returnsGeneratedPiwikJsWithMer ', $content); } - public function test_getUpdatedTrackerFileContent_returnsSourceFile_IfNoTrackerFilesFound() + public function testGetUpdatedTrackerFileContentReturnsSourceFileIfNoTrackerFilesFound() { $source = $this->dir . 'testpiwik.js'; $target = $this->dir . 'MyTestTarget.js'; @@ -181,14 +181,14 @@ public function test_getUpdatedTrackerFileContent_returnsSourceFile_IfNoTrackerF $this->assertSame(file_get_contents($source), $content); } - public function test_update_shouldNotThrowAnError_IfTargetFileIsNotWritable() + public function testUpdateShouldNotThrowAnErrorIfTargetFileIsNotWritable() { $updater = $this->makeUpdater(null, $this->dir . 'not-writable/MyNotExisIngFilessss.js'); $updater->update(); $this->assertNull($this->trackerJsChangedEventPath); } - public function test_update_shouldNotWriteToFileIfThereIsNothingToChange() + public function testUpdateShouldNotWriteToFileIfThereIsNothingToChange() { $source = $this->dir . 'testpiwik.js'; $target = $this->dir . 'MyTestTarget.js'; @@ -202,7 +202,7 @@ public function test_update_shouldNotWriteToFileIfThereIsNothingToChange() $this->assertNull($this->trackerJsChangedEventPath); } - public function test_update_targetFileIfPluginsDefineDifferentFiles() + public function testUpdateTargetFileIfPluginsDefineDifferentFiles() { $target = $this->dir . 'MyTestTarget.js'; file_put_contents($target, ''); // file has to exist in order to work diff --git a/plugins/CustomJsTracker/tests/System/PiwikJsContentTest.php b/plugins/CustomJsTracker/tests/System/PiwikJsContentTest.php index 1a60ab0033a..b55f1252e54 100644 --- a/plugins/CustomJsTracker/tests/System/PiwikJsContentTest.php +++ b/plugins/CustomJsTracker/tests/System/PiwikJsContentTest.php @@ -21,7 +21,7 @@ */ class PiwikJsContentTest extends SystemTestCase { - public function test_piwikJsAndPiwikMinJsMustHaveSameContent() + public function testPiwikJsAndPiwikMinJsMustHaveSameContent() { $piwikMin = PIWIK_DOCUMENT_ROOT . TrackerUpdater::ORIGINAL_PIWIK_JS; $piwikJs = PIWIK_DOCUMENT_ROOT . TrackerUpdater::TARGET_MATOMO_JS; @@ -29,7 +29,7 @@ public function test_piwikJsAndPiwikMinJsMustHaveSameContent() $this->assertSame(file_get_contents($piwikMin), file_get_contents($piwikJs)); } - public function test_piwikJsContainsHook() + public function testPiwikJsContainsHook() { $piwikMin = PIWIK_DOCUMENT_ROOT . '/js/piwik.min.js'; $content = file_get_contents($piwikMin);