Rename kEventPOSTVarKey to kEventNameKey.
Rename kEventPOSTVarKey to kEventNameKey.
diff --git a/events/context.php b/events/context.php
index 70ad4c4..3746bb8 100644
--- a/events/context.php
+++ b/events/context.php
@@ -21,7 +21,7 @@ namespace phalanx\events;
class Context
{
// The POST variable name used to determine the event to raise.
- const kEventPOSTVarKey = 'phalanx_event';
+ const kEventNameKey = 'phalanx_event';
// GPC variables. By default these are unsanitized. On construction, the
// variable arrays are copied from their respective superglobals.
@@ -54,19 +54,19 @@ class Context
// This raises events based on incoming GET and POST data. If it's a GET
// request, the URL will be used to determine the event. If the request is
- // a POST one, the key |kEventPOSTVarKey| will be used to determine the
+ // a POST one, the key |kEventNameKey| will be used to determine the
// event. If neither one of those works, an exception is thrown.
public function dispatch()
{
$method = strtolower($_SERVER['REQUEST_METHOD']);
if ($method == 'post')
{
- $event_name = $this->gpc->get('p.' . self::kEventPOSTVarKey);
+ $event_name = $this->gpc->get('p.' . self::kEventNameKey);
}
else if ($method == 'get')
{
$this->_tokenizeURL();
- $event_name = $this->gpc->get('g.' . self::kEventPOSTVarKey);
+ $event_name = $this->gpc->get('g.' . self::kEventNameKey);
}
else
{
@@ -97,7 +97,7 @@ class Context
$parts = explode('/', $url);
\phalanx\base\array_strip_empty($parts);
- $this->gpc->set('g.' . self::kEventPOSTVarKey, $parts[0]);
+ $this->gpc->set('g.' . self::kEventNameKey, $parts[0]);
$i = 1;
if (is_numeric($parts[$i]))
diff --git a/testing/tests/events/context_test.php b/testing/tests/events/context_test.php
index 7b89c19..46a88d4 100644
--- a/testing/tests/events/context_test.php
+++ b/testing/tests/events/context_test.php
@@ -86,7 +86,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase
$_GET['__dispatch__'] = '/test_event/';
$context = new TestContext();
$context->T_tokenizeURL();
- $this->assertEquals('test_event', $context->gpc()->get('g.' . TestContext::kEventPOSTVarKey));
+ $this->assertEquals('test_event', $context->gpc()->get('g.' . TestContext::kEventNameKey));
}
public function testTokenizeURLWithID()
@@ -94,7 +94,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase
$_GET['__dispatch__'] = '/test/314159/';
$context = new TestContext();
$context->T_tokenizeURL();
- $this->assertEquals('test', $context->gpc()->get('g.' . TestContext::kEventPOSTVarKey));
+ $this->assertEquals('test', $context->gpc()->get('g.' . TestContext::kEventNameKey));
$this->assertEquals('314159', $context->gpc()->get('g.id'));
}
@@ -103,7 +103,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase
$_GET['__dispatch__'] = '/test_event/k1/v1/';
$context = new TestContext();
$context->T_tokenizeURL();
- $this->assertEquals('test_event', $context->gpc()->get('g.' . TestContext::kEventPOSTVarKey));
+ $this->assertEquals('test_event', $context->gpc()->get('g.' . TestContext::kEventNameKey));
$this->assertEquals('v1', $context->gpc()->get('g.k1'));
}
@@ -112,7 +112,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase
$_GET['__dispatch__'] = '/test_event/k1/v1/k2/v2/';
$context = new TestContext();
$context->T_tokenizeURL();
- $this->assertEquals('test_event', $context->gpc()->get('g.' . TestContext::kEventPOSTVarKey));
+ $this->assertEquals('test_event', $context->gpc()->get('g.' . TestContext::kEventNameKey));
$this->assertEquals('v1', $context->gpc()->get('g.k1'));
$this->assertEquals('v2', $context->gpc()->get('g.k2'));
}
@@ -130,7 +130,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase
$_GET['__dispatch__'] = '/test_event/314159/k1/v1/';
$context = new TestContext();
$context->T_tokenizeURL();
- $this->assertEquals('test_event', $context->gpc()->get('g.' . TestContext::kEventPOSTVarKey));
+ $this->assertEquals('test_event', $context->gpc()->get('g.' . TestContext::kEventNameKey));
$this->assertEquals('314159', $context->gpc()->get('g.id'));
$this->assertEquals('v1', $context->gpc()->get('g.k1'));
}
@@ -153,7 +153,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase
public function testDispatchPOST()
{
$_SERVER['REQUEST_METHOD'] = 'POST';
- $_POST[TestContext::kEventPOSTVarKey] = 'test_event';
+ $_POST[TestContext::kEventNameKey] = 'test_event';
$pump = events\EventPump::pump();
$context = new TestContext();
$pump->set_context($context);