Skip to content

Commit

Permalink
[Coding Style] Use camel case for method names in CustomDimensions an…
Browse files Browse the repository at this point in the history
…d CustomJSTracker plugin tests (#22148)
  • Loading branch information
sgiehl authored Apr 23, 2024
1 parent e668346 commit e41647d
Show file tree
Hide file tree
Showing 23 changed files with 177 additions and 177 deletions.
32 changes: 16 additions & 16 deletions plugins/CustomDimensions/tests/Integration/ApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand All @@ -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');

Expand All @@ -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');
Expand All @@ -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());
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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\'');
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -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());

Expand Down
24 changes: 12 additions & 12 deletions plugins/CustomDimensions/tests/Integration/CustomDimensionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand All @@ -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) {
Expand All @@ -87,7 +87,7 @@ public function test_uninstall_shouldRemoveAllColumnsFromLogTablesAndUninstallCo
$this->plugin->install();
}

public function test_addVisitFieldsToPersist()
public function testAddVisitFieldsToPersist()
{
$fields = array('existingField');

Expand All @@ -105,7 +105,7 @@ public function test_addVisitFieldsToPersist()
$this->assertSame($expected, $fields);
}

public function test_addConversionInformation()
public function testAddConversionInformation()
{
$this->configureSomeDimensions();

Expand All @@ -128,7 +128,7 @@ public function test_addConversionInformation()
), $conversion);
}

public function test_addConversionInformation_shouldIgnoreAnIndexIfTheIndexIsMissingInConversionTable()
public function testAddConversionInformationShouldIgnoreAnIndexIfTheIndexIsMissingInConversionTable()
{
$this->configureSomeDimensions();

Expand All @@ -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);
Expand All @@ -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();
Expand All @@ -183,7 +183,7 @@ public function test_shouldCacheInstalledIndexes()
}
}

public function test_shouldCacheDimensinsViaWebsiteAttributes_ButOnlyActiveOnes()
public function testShouldCacheDimensinsViaWebsiteAttributesButOnlyActiveOnes()
{
$this->configureSomeDimensions();
$cache = Cache::getCacheWebsiteAttributes($idSite = 1);
Expand All @@ -201,7 +201,7 @@ public function test_shouldCacheDimensinsViaWebsiteAttributes_ButOnlyActiveOnes(
}
}

public function test_extendVisitorDetails()
public function testExtendVisitorDetails()
{
$this->configureSomeDimensions();

Expand All @@ -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();
Expand All @@ -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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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');
Expand All @@ -66,7 +66,7 @@ public function test_shouldBeAbleToUninstallConfigTable()
$this->config->install();
}

public function test_configureNewDimension_shouldGenerateDimensionIdCorrectlyAndShouldNextFreeId()
public function testConfigureNewDimensionShouldGenerateDimensionIdCorrectlyAndShouldNextFreeId()
{
$cases = $this->createManyCustomDimensionCases();

Expand All @@ -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');
Expand All @@ -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';
Expand All @@ -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';
Expand All @@ -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();
Expand All @@ -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();

Expand Down Expand Up @@ -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));
}
Expand All @@ -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();

Expand All @@ -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();

Expand All @@ -242,7 +242,7 @@ public function test_getCustomDimension_shouldReturnDimension()
$this->assertSame($expected, $dimension);
}

public function test_getCustomDimensionsForSite_shouldFindEntriesHavingThisSite()
public function testGetCustomDimensionsForSiteShouldFindEntriesHavingThisSite()
{
$this->createManyCustomDimensionCases();

Expand All @@ -267,7 +267,7 @@ public function test_getCustomDimensionsForSite_shouldFindEntriesHavingThisSite(
$this->assertSame(array(), $dimensions);
}

public function test_getCustomDimensionsHavingIndex_shouldFindEntriesHavingIndexAndSite()
public function testGetCustomDimensionsHavingIndexShouldFindEntriesHavingIndexAndSite()
{
$this->createManyCustomDimensionCases();

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Loading

0 comments on commit e41647d

Please sign in to comment.