Page MenuHomePhabricator

Extend from Phobject
ClosedPublic

Authored by joshuaspence on Jun 14 2015, 12:48 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 11, 8:20 AM
Unknown Object (File)
Tue, Apr 9, 1:27 PM
Unknown Object (File)
Tue, Apr 2, 2:39 AM
Unknown Object (File)
Fri, Mar 29, 10:21 AM
Unknown Object (File)
Fri, Mar 29, 9:55 AM
Unknown Object (File)
Tue, Mar 26, 2:40 AM
Unknown Object (File)
Mar 17 2024, 11:28 PM
Unknown Object (File)
Feb 20 2024, 9:27 PM
Subscribers

Details

Summary

Ensure that all base classes extend from Phobject. See D13275 for some explanation.

Test Plan

arc unit

Diff Detail

Repository
rPHU libphutil
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

joshuaspence retitled this revision from to Extend from Phoject.
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.

There were two issues with the unit tests. Firstly, I was unable to run the test suite due to the change to PhutilTestClassA:

Exception
Attempting to run unit tests on a libphutil library which has not been loaded, at:

    /home/joshua/workspace/github.com/phacility/libphutil/support/phutiltestlib

This probably means one of two things:

    - You may need to add this library to .arcconfig..
    - You may be running tests on a copy of libphutil or arcanist using a different copy of libphutil or arcanist. This operation is not supported.

(Run with `--trace` for a full exception trace.)

Secondly, I'm not sure why this test was failing:

   FAIL  PhutilRemarkupEngineTestCase::testEngine
EXCEPTION (DomainException): Attempt to write to undeclared property PhutilRemarkupEngine::storage.
#0 /home/joshua/workspace/github.com/phacility/libphutil/src/markup/engine/PhutilRemarkupEngine.php(285): Phobject->__set('storage', Object(PhutilRemarkupBlockStorage))
#1 /home/joshua/workspace/github.com/phacility/libphutil/src/markup/engine/PhutilRemarkupEngine.php(94): PhutilRemarkupEngine->postprocessText(Array)
#2 /home/joshua/workspace/github.com/phacility/libphutil/src/markup/engine/__tests__/PhutilRemarkupEngineTestCase.php(43): PhutilRemarkupEngine->markupText('**duck\nquack**')
#3 /home/joshua/workspace/github.com/phacility/libphutil/src/markup/engine/__tests__/PhutilRemarkupEngineTestCase.php(11): PhutilRemarkupEngineTestCase->markupText('/home/joshua/wo...')
#4 [internal function]: PhutilRemarkupEngineTestCase->testEngine()
#5 /home/joshua/workspace/github.com/phacility/arcanist/src/unit/engine/phutil/PhutilTestCase.php(492): call_user_func_array(Array, Array)
#6 /home/joshua/workspace/github.com/phacility/arcanist/src/unit/engine/PhutilUnitTestEngine.php(65): PhutilTestCase->run()
#7 /home/joshua/workspace/github.com/phacility/arcanist/src/workflow/ArcanistUnitWorkflow.php(186): PhutilUnitTestEngine->run()
#8 /home/joshua/workspace/github.com/phacility/arcanist/scripts/arcanist.php(382): ArcanistUnitWorkflow->run()
#9 {main}

Firstly, I was unable to run the test suite due to the change

Maybe we just leave the warning for now (don't extend Phobject) and eventually fix it with T1549?

Secondly, I'm not sure why this test was failing:

This looks like a real issue which this change has detected: PhutilRemarkupEngine reads and writes to a property called $storage, but does not declare such a property. The fix is probably adding private $storage; to the class.

This looks like a real issue which this change has detected: PhutilRemarkupEngine reads and writes to a property called $storage, but does not declare such a property. The fix is probably adding private $storage; to the class.

Right, but I did add that to the class.

Oh!

This:

unset($this->storage);

Probably needs to be:

$this->storage = null;

Because PHP LOL.

I learn something new every day...

chad retitled this revision from Extend from Phoject to Extend from Phobject.Jun 14 2015, 8:49 PM
chad edited edge metadata.

Maybe we just leave the warning for now (don't extend Phobject) and eventually fix it with T1549?

To clarify, the issue is that the .arcconfig file doesn't load support/phutiltestlib. This maybe seems like a general issue in that you can't properly diff libraries which aren't explicitly loaded.

  • Fix PhutilRemarkupEngine
  • Remove change to PhutilTestClassA for now
epriestley edited edge metadata.
This revision is now accepted and ready to land.Jun 14 2015, 9:49 PM
This revision was automatically updated to reflect the committed changes.