Skip to content

Commit

Permalink
🖊️ Renamed fireNotifications to sendNot..
Browse files Browse the repository at this point in the history
  • Loading branch information
oakbani committed Nov 17, 2017
1 parent bd218fc commit 898242f
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion src/Optimizely/Notification/NotificationCenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public function cleanAllNotifications()
* @param array $args Array of items to pass as arguments to the callback
*
*/
public function fireNotifications($notification_type, array $args = [])
public function sendNotifications($notification_type, array $args = [])
{
if (!isset($this->_notifications[$notification_type])) {
// No exception thrown and error logged since this method will be called from
Expand Down
10 changes: 5 additions & 5 deletions src/Optimizely/Optimizely.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ protected function sendImpressionEvent($experimentKey, $variationKey, $userId, $
));
}

$this->_notificationCenter->fireNotifications(
$this->_notificationCenter->sendNotifications(
NotificationType::ACTIVATE,
array(
$this->_config->getExperimentFromKey($experimentKey),
Expand Down Expand Up @@ -353,7 +353,7 @@ public function track($eventKey, $userId, $attributes = null, $eventTags = null)
'Unable to dispatch conversion event. Error %s', $exception->getMessage()));
}

$this->_notificationCenter->fireNotifications(
$this->_notificationCenter->sendNotifications(
NotificationType::TRACK,
array(
$eventKey,
Expand Down Expand Up @@ -491,7 +491,7 @@ public function isFeatureEnabled($featureFlagKey, $userId, $attributes = null)

$this->sendImpressionEvent($experiment->getKey(), $variation->getKey(), $userId, $attributes);

$this->_notificationCenter->fireNotifications(
$this->_notificationCenter->sendNotifications(
NotificationType::FEATURE_EXPERIMENT,
array(
$featureFlagKey,
Expand All @@ -513,13 +513,13 @@ public function isFeatureEnabled($featureFlagKey, $userId, $attributes = null)
}


$this->_notificationCenter->fireNotifications(
$this->_notificationCenter->sendNotifications(
NotificationType::FEATURE_ROLLOUT,
array(
$featureFlagKey,
$userId,
$attributes,
$audience
[$audience]
)
);
}
Expand Down
12 changes: 6 additions & 6 deletions tests/NotificationTests/NotificationCenterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ public function testCleanAllNotifications()
$notificationCenterA->cleanAllNotifications();
}

public function testFireNotificationsGivenLessThanExpectedNumberOfArguments()
public function testsendNotificationsGivenLessThanExpectedNumberOfArguments()
{
$clientObj = new FireNotificationTester;
$this->notificationCenterObj->cleanAllNotifications();
Expand All @@ -599,10 +599,10 @@ public function testFireNotificationsGivenLessThanExpectedNumberOfArguments()
->method('log')
->with(Logger::ERROR, "Problem calling notify callback.");

$this->notificationCenterObj->fireNotifications(NotificationType::ACTIVATE, array("HelloWorld"));
$this->notificationCenterObj->sendNotifications(NotificationType::ACTIVATE, array("HelloWorld"));
}

public function testFireNotificationsAndVerifyThatAllCallbacksWithoutArgsAreCalled()
public function testsendNotificationsAndVerifyThatAllCallbacksWithoutArgsAreCalled()
{
$clientMock = $this->getMockBuilder(FireNotificationTester::class)
->setMethods(array('decision_callback_no_args', 'decision_callback_no_args_2', 'track_callback_no_args'))
Expand Down Expand Up @@ -636,10 +636,10 @@ public function testFireNotificationsAndVerifyThatAllCallbacksWithoutArgsAreCall
$clientMock->expects($this->never())
->method('track_callback_no_args');

$this->notificationCenterObj->fireNotifications(NotificationType::ACTIVATE);
$this->notificationCenterObj->sendNotifications(NotificationType::ACTIVATE);
}

public function testFireNotificationsAndVerifyThatAllCallbacksWithArgsAreCalled()
public function testsendNotificationsAndVerifyThatAllCallbacksWithArgsAreCalled()
{
$clientMock = $this->getMockBuilder(FireNotificationTester::class)
->setMethods(array('decision_callback_with_args', 'decision_callback_with_args_2', 'track_callback_no_args'))
Expand Down Expand Up @@ -676,7 +676,7 @@ public function testFireNotificationsAndVerifyThatAllCallbacksWithArgsAreCalled(
$clientMock->expects($this->never())
->method('track_callback_no_args');

$this->notificationCenterObj->fireNotifications(
$this->notificationCenterObj->sendNotifications(
NotificationType::ACTIVATE,
array(5, 5.5, 'string', array(5,6), function () {
})
Expand Down
64 changes: 32 additions & 32 deletions tests/OptimizelyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function setUp()

$this->notificationCenterMock = $this->getMockBuilder(NotificationCenter::class)
->setConstructorArgs(array($this->loggerMock, new NoOpErrorHandler))
->setMethods(array('fireNotifications'))
->setMethods(array('sendNotifications'))
->getMock();
}

Expand Down Expand Up @@ -641,9 +641,9 @@ public function testTrackInvalidOptimizelyObject()
$notificationCenter->setAccessible(true);
$notificationCenter->setValue($optlyObject, $this->notificationCenterMock);

// Verify that fireNotifications isn't called
// Verify that sendNotifications isn't called
$this->notificationCenterMock->expects($this->never())
->method('fireNotifications');
->method('sendNotifications');

$optlyObject->track('some_event', 'some_user');
$this->expectOutputRegex('/Datafile has invalid format. Failing "track"./');
Expand All @@ -670,9 +670,9 @@ public function testTrackInvalidAttributes()
$notificationCenter->setAccessible(true);
$notificationCenter->setValue($optlyObject, $this->notificationCenterMock);

// Verify that fireNotifications isn't called
// Verify that sendNotifications isn't called
$this->notificationCenterMock->expects($this->never())
->method('fireNotifications');
->method('sendNotifications');

// Call activate
$this->assertNull($optlyObject->track('purchase', 'test_user', 42));
Expand Down Expand Up @@ -762,7 +762,7 @@ public function testTrackNoAttributesNoEventValue()
$notificationCenter->setAccessible(true);
$notificationCenter->setValue($optlyObject, $this->notificationCenterMock);

// Verify that fireNotifications is called with expected params
// Verify that sendNotifications is called with expected params
$arrayParam = array(
'purchase',
'test_user',
Expand All @@ -772,7 +772,7 @@ public function testTrackNoAttributesNoEventValue()
);

$this->notificationCenterMock->expects($this->once())
->method('fireNotifications')
->method('sendNotifications')
->with(
NotificationType::TRACK,
$arrayParam
Expand Down Expand Up @@ -879,7 +879,7 @@ public function testTrackNoAttributesNoEventValueAfterSetForcedVariation()
$notificationCenter->setAccessible(true);
$notificationCenter->setValue($optlyObject, $this->notificationCenterMock);

// Verify that fireNotifications is called with expected params
// Verify that sendNotifications is called with expected params
$arrayParam = array(
'purchase',
'test_user',
Expand All @@ -889,7 +889,7 @@ public function testTrackNoAttributesNoEventValueAfterSetForcedVariation()
);

$this->notificationCenterMock->expects($this->once())
->method('fireNotifications')
->method('sendNotifications')
->with(
NotificationType::TRACK,
$arrayParam
Expand Down Expand Up @@ -998,7 +998,7 @@ public function testTrackWithAttributesNoEventValue()
$notificationCenter->setAccessible(true);
$notificationCenter->setValue($optlyObject, $this->notificationCenterMock);

// Verify that fireNotifications is called with expected params
// Verify that sendNotifications is called with expected params
$arrayParam = array(
'purchase',
'test_user',
Expand All @@ -1008,7 +1008,7 @@ public function testTrackWithAttributesNoEventValue()
);

$this->notificationCenterMock->expects($this->once())
->method('fireNotifications')
->method('sendNotifications')
->with(
NotificationType::TRACK,
$arrayParam
Expand Down Expand Up @@ -1110,7 +1110,7 @@ public function testTrackNoAttributesWithDeprecatedEventValue()
$notificationCenter->setAccessible(true);
$notificationCenter->setValue($optlyObject, $this->notificationCenterMock);

// Verify that fireNotifications is called with expected params
// Verify that sendNotifications is called with expected params
$arrayParam = array(
'purchase',
'test_user',
Expand All @@ -1120,7 +1120,7 @@ public function testTrackNoAttributesWithDeprecatedEventValue()
);

$this->notificationCenterMock->expects($this->once())
->method('fireNotifications')
->method('sendNotifications')
->with(
NotificationType::TRACK,
$arrayParam
Expand Down Expand Up @@ -1217,7 +1217,7 @@ public function testTrackNoAttributesWithEventValue()
$notificationCenter->setAccessible(true);
$notificationCenter->setValue($optlyObject, $this->notificationCenterMock);

// Verify that fireNotifications is called with expected params
// Verify that sendNotifications is called with expected params
$arrayParam = array(
'purchase',
'test_user',
Expand All @@ -1227,7 +1227,7 @@ public function testTrackNoAttributesWithEventValue()
);

$this->notificationCenterMock->expects($this->once())
->method('fireNotifications')
->method('sendNotifications')
->with(
NotificationType::TRACK,
$arrayParam
Expand Down Expand Up @@ -1313,7 +1313,7 @@ public function testTrackNoAttributesWithInvalidEventValue()
$notificationCenter->setAccessible(true);
$notificationCenter->setValue($optlyObject, $this->notificationCenterMock);

// Verify that fireNotifications is called with expected params
// Verify that sendNotifications is called with expected params
$arrayParam = array(
'purchase',
'test_user',
Expand All @@ -1323,7 +1323,7 @@ public function testTrackNoAttributesWithInvalidEventValue()
);

$this->notificationCenterMock->expects($this->once())
->method('fireNotifications')
->method('sendNotifications')
->with(
NotificationType::TRACK,
$arrayParam
Expand Down Expand Up @@ -1435,7 +1435,7 @@ public function testTrackWithAttributesWithDeprecatedEventValue()
$notificationCenter->setAccessible(true);
$notificationCenter->setValue($optlyObject, $this->notificationCenterMock);

// Verify that fireNotifications is called with expected params
// Verify that sendNotifications is called with expected params
$arrayParam = array(
'purchase',
'test_user',
Expand All @@ -1445,7 +1445,7 @@ public function testTrackWithAttributesWithDeprecatedEventValue()
);

$this->notificationCenterMock->expects($this->once())
->method('fireNotifications')
->method('sendNotifications')
->with(
NotificationType::TRACK,
$arrayParam
Expand Down Expand Up @@ -1552,7 +1552,7 @@ public function testTrackWithAttributesWithEventValue()
$notificationCenter->setAccessible(true);
$notificationCenter->setValue($optlyObject, $this->notificationCenterMock);

// Verify that fireNotifications is called with expected params
// Verify that sendNotifications is called with expected params
$arrayParam = array(
'purchase',
'test_user',
Expand All @@ -1562,7 +1562,7 @@ public function testTrackWithAttributesWithEventValue()
);

$this->notificationCenterMock->expects($this->once())
->method('fireNotifications')
->method('sendNotifications')
->with(
NotificationType::TRACK,
$arrayParam
Expand Down Expand Up @@ -1995,9 +1995,9 @@ public function testIsFeatureEnabledGivenFeatureFlagIsNotEnabledForUser()
$notificationCenter->setAccessible(true);
$notificationCenter->setValue($optimizelyMock, $this->notificationCenterMock);

// verify that fireNotifications isn't called
// verify that sendNotifications isn't called
$this->notificationCenterMock->expects($this->never())
->method('fireNotifications');
->method('sendNotifications');

$this->loggerMock->expects($this->at(0))
->method('log')
Expand Down Expand Up @@ -2048,7 +2048,7 @@ public function testIsFeatureEnabledGivenFeatureFlagIsEnabledAndUserIsBeingExper
$notificationCenter->setAccessible(true);
$notificationCenter->setValue($optimizelyMock, $this->notificationCenterMock);

// verify that fireNotifications is called with expected params
// verify that sendNotifications is called with expected params
$arrayParam = array(
'double_single_variable_feature',
'user_id',
Expand All @@ -2058,7 +2058,7 @@ public function testIsFeatureEnabledGivenFeatureFlagIsEnabledAndUserIsBeingExper
);

$this->notificationCenterMock->expects($this->once())
->method('fireNotifications')
->method('sendNotifications')
->with( NotificationType::FEATURE_EXPERIMENT, $arrayParam);

$this->loggerMock->expects($this->at(0))
Expand Down Expand Up @@ -2101,16 +2101,16 @@ public function testIsFeatureEnabledGivenFeatureFlagIsEnabledAndUserIsNotBeingEx
$notificationCenter->setAccessible(true);
$notificationCenter->setValue($optimizelyMock, $this->notificationCenterMock);

// verify that fireNotifications is called with expected params
// verify that sendNotifications is called with expected params
$arrayParam = array(
'boolean_single_variable_feature',
'user_id',
[],
$this->projectConfig->getAudience($experiment->getAudienceIds()[0])
[$this->projectConfig->getAudience($experiment->getAudienceIds()[0])]
);

$this->notificationCenterMock->expects($this->once())
->method('fireNotifications')
->method('sendNotifications')
->with( NotificationType::FEATURE_ROLLOUT, $arrayParam);

$decisionServiceMock->expects($this->exactly(1))
Expand Down Expand Up @@ -2526,7 +2526,7 @@ public function testSendImpressionEventWithNoAttributes(){
['param1' => 'val1', 'param2' => 'val2'], 'POST', [])
);

// verify that fireNotifications is called with expected params
// verify that sendNotifications is called with expected params
$arrayParam = array(
$this->projectConfig->getExperimentFromKey('group_experiment_1'),
'user_1',
Expand All @@ -2538,7 +2538,7 @@ public function testSendImpressionEventWithNoAttributes(){
);

$this->notificationCenterMock->expects($this->once())
->method('fireNotifications')
->method('sendNotifications')
->with(
NotificationType::ACTIVATE,
$arrayParam
Expand Down Expand Up @@ -2584,7 +2584,7 @@ public function testSendImpressionEventWithAttributes(){
)
->willReturn(new LogEvent('logx.optimizely.com/decision', ['param1' => 'val1'], 'POST', []));

// verify that fireNotifications is called with expected params
// verify that sendNotifications is called with expected params
$arrayParam = array(
$this->projectConfig->getExperimentFromKey('test_experiment'),
'test_user',
Expand All @@ -2596,7 +2596,7 @@ public function testSendImpressionEventWithAttributes(){
);

$this->notificationCenterMock->expects($this->once())
->method('fireNotifications')
->method('sendNotifications')
->with(
NotificationType::ACTIVATE,
$arrayParam
Expand Down

0 comments on commit 898242f

Please sign in to comment.