Browse Source

add missing deprecation into Event::data()

saeid 7 years ago
parent
commit
8a98ec8ed7

+ 2 - 0
src/Event/Event.php

@@ -242,6 +242,8 @@ class Event implements EventInterface
      */
     public function data($key = null)
     {
+        deprecationWarning('Event::data() is deprecated. Use Event::getData() instead.');
+
         return $this->getData($key);
     }
 

+ 1 - 1
tests/TestCase/Event/Decorator/ConditionDecoratorTest.php

@@ -88,7 +88,7 @@ class ConditionDecoratorTest extends TestCase
         ]);
 
         EventManager::instance()->dispatch($event);
-        $this->assertEquals(2, $event->data('counter'));
+        $this->assertEquals(2, $event->getData('counter'));
     }
 
     /**

+ 1 - 1
tests/test_app/TestApp/Auth/TestAuthenticate.php

@@ -54,7 +54,7 @@ class TestAuthenticate extends BaseAuthenticate
     public function afterIdentify(Event $event, array $user)
     {
         $this->callStack[] = __FUNCTION__;
-        $this->authenticationProvider = $event->data(1);
+        $this->authenticationProvider = $event->getData(1);
 
         if (!empty($this->modifiedUser)) {
             return $user + ['extra' => 'foo'];