Page MenuHomeIn-Portal Phabricator

INP-1662 - Add methods for handling deprecations
ClosedPublic

Authored by alex on Jan 1 2017, 3:33 PM.

Details

Test Plan

Preparations

  1. in Web Browser:
    • login to Admin Console
    • go to Logs & ReportsSystem Log section
  2. in IDE:
    • add these lines to the beginning of the kUnitConfigReader::scanModules method:
trigger_error('regular notice', E_USER_NOTICE);
kUtil::deprecatedMethod(__METHOD__, 'V1');
kUtil::deprecatedMethod(__METHOD__, 'V2', 'newMethod()');
kUtil::deprecatedArgument(__METHOD__, 'V3');
kUtil::deprecatedArgument(__METHOD__, 'V3', 'The "$cache" argument is deprecated.');

Part 1

  1. enable Debug Mode in /system/debug.php file
  2. confirm, that:
    • regular notice appear in both Debugger and System Log and have these messages:
      • regular notice
    • notice has Notice (#...) red text displayed in front of the message in Debugger (the ... can be any number)
    • deprecation notices appear in both Debugger and System Log and have these messages:
      • kUnitConfigReader::scanModules is deprecated since version V1 with no alternative available.
      • kUnitConfigReader::scanModules is deprecated since version V2! Use newMethod() instead.
      • kUnitConfigReader::scanModules was called with an argument that is deprecated since version V3 with no alternative available.
      • kUnitConfigReader::scanModules was called with an argument that is deprecated since version V3! The "$cache" argument is deprecated.
    • the deprecated word in each error message is written in bold (in both Debugger and System Log)
    • deprecation notices have Deprecation Notice (#...) red text displayed in front of the message in Debugger (the ... can be any number)
  3. set error in Show dropdown on top of the Debugger report
  4. confirm, that only records with Notice and Debugger Notice red prefixes are displayed

Part 2

  1. disable Debug Mode in /system/debug.php file
  2. reload the page
  3. confirm, that only regular notice notice is logged in into System Log

Part 3

  1. enable Debug Mode in /system/debug.php file
  2. in IDE:
    • add this code to the /admin/index.php file after $application->Init(); call:
/** @var OrderHelper $order_helper */
$order_helper = $application->recallObject('OrderHelper');
$order_helper->getCreditCartType('xx');
  1. confirm, that in OrderHelper::getCreditCartType method:
    • the version is indicated in @deprecated tag
    • the @see tag is present indicating correct method name to be called
  2. in Web Browser:
    • reload the page
    • confirm, that deprecation notice with OrderHelper::getCreditCartType is deprecated since version 5.2.2-B1! Use OrderHelper::getCreditCardType instead. text appears
    • confirm, that the deprecated word in each error message is written in bold (in both Debugger and System Log)

Part 4

  • go to IDE
  • confirm, that only silenced deprecation notices are triggered from 2 added kUtil class methods

Diff Detail

Repository
rINP In-Portal
Branch
/in-portal/branches/5.2.x
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 635
Build 635: arc lint + arc unit

Event Timeline

alex updated this revision to Diff 668.Jan 1 2017, 3:33 PM
alex retitled this revision from to INP-1662 - Add methods for handling deprecations.
alex updated this object.
alex edited the test plan for this revision. (Show Details)
alex added 1 JIRA issue(s): INP-1662.
alex edited the test plan for this revision. (Show Details)Jan 1 2017, 3:40 PM
alex edited edge metadata.
alex edited the test plan for this revision. (Show Details)
alex updated this revision to Diff 669.Jan 1 2017, 3:46 PM

Rolling back accidental function to method replacements in non-changed code.

alex edited the test plan for this revision. (Show Details)Jan 1 2017, 3:49 PM
erik requested changes to this revision.Jan 4 2017, 4:32 AM
erik edited edge metadata.

Test plan must be fixed. "Enable Debug Mode in /system/debug.php file" must be added somewhere between Part 2 and Part 3. Otherwise at Part 3 Debug Mode is disabled and confirmation about appearance of notices is not possible - notices does not appear.

This revision now requires changes to proceed.Jan 4 2017, 4:32 AM
alex requested a review of this revision.Jan 4 2017, 5:06 AM
alex edited the test plan for this revision. (Show Details)
alex edited edge metadata.
alex edited edge metadata.
erik accepted this revision.Jan 10 2017, 4:36 AM
erik edited edge metadata.
This revision is now accepted and ready to land.Jan 10 2017, 4:36 AM
alex planned changes to this revision.Feb 10 2017, 2:32 AM

Handle hook processing deprecation in kUnitConfigReader::parseHooks method using kUtil::deprecatedArgument('kApplication::registerHook', ...).

alex requested a review of this revision.Feb 10 2017, 5:38 AM

Decided not to change anything after all, because we're not insisting on #PARENT# usage in hooks, but recommending it.

This revision is now accepted and ready to land.Feb 10 2017, 5:38 AM
This revision was automatically updated to reflect the committed changes.