Page MenuHomeIn-Portal Phabricator

INP-1484 - Connect "Symfony Process" component
ClosedPublic

Authored by alex on Sep 20 2015, 1:38 PM.

Details

Test Plan

Part 1

  1. after applying patch run composer install command
  2. try installing In-Portal on PHP < 5.3.9
  3. confirm, that it's not possible due error on System Requirements step
  4. try installing In-Portal on PHP >= 5.3.9
  5. confirm, that it's possible
  6. create new tag (e.g. ProcessBuilderTest in kMainTagProcessor class)
  7. place <inp2:m_ProcessBuilderTest/> tag on the index.tpl template in advanced theme
  8. confirm, that tag result is shown when visiting Front-End

Part 2

  • place following in the tag:
/** @var ProcessBuilder $process_builder */
$process_builder = $this->Application->recallObject('ProcessBuilder');
  • confirm, that exception about recallObject method usage is thrown

Part 3

  • place following in the tag:
/** @var ProcessBuilder $process_builder */
$process_builder = $this->Application->makeClass('ProcessBuilder');

$process = $process_builder->setCommand('ls -la')->build();
$process->mustRun();

return '<pre>' . kUtil::escape($process->getOutput(), kUtil::ESCAPE_HTML) . '</pre>';
  • confirm, that tag output contains results from running ls -la command

Part 4

  • place following in the tag:
/** @var ProcessBuilder $process_builder */
$process_builder = $this->Application->makeClass('ProcessBuilder');

$process = $process_builder->setExecutable('ls')->add('-la')->build();
$process->mustRun();

return '<pre>' . kUtil::escape($process->getOutput(), kUtil::ESCAPE_HTML) . '</pre>';
  • confirm, that tag output contains results from running ls -la command

Part 5

  • place following in the tag:
/** @var ProcessBuilder $process_builder */
$process_builder = $this->Application->makeClass('ProcessBuilder');

$process = $process_builder->setExecutable('pwd')->build();
$process->mustRun();

return '<pre>' . kUtil::escape($process->getOutput(), kUtil::ESCAPE_HTML) . '</pre>';
  • confirm, that tag output contains current working directory (usually result of FULL_PATH constant)

Part 6

  • place following in the tag:
/** @var ProcessBuilder $process_builder */
$process_builder = $this->Application->makeClass('ProcessBuilder');

$process = $process_builder->setExecutable('pwd')->setWorkingDirectory(WRITEABLE)->build();
$process->mustRun();

return '<pre>' . kUtil::escape($process->getOutput(), kUtil::ESCAPE_HTML) . '</pre>';
  • confirm, that tag output contains WRITEABLE constant value

Part 7

  • place following in the tag:
/** @var ProcessBuilder $process_builder */
$process_builder = $this->Application->makeClass('ProcessBuilder');

$process = $process_builder->setExecutable('/usr/bin/printenv')->build();
$process->mustRun();

return '<pre>' . kUtil::escape($process->getOutput(), kUtil::ESCAPE_HTML) . '</pre>';
  • confirm, that tag output contains all environment variables of PHP process (usually seen in $_ENV or $_SERVER)

Part 8

  • place following in the tag:
/** @var ProcessBuilder $process_builder */
$process_builder = $this->Application->makeClass('ProcessBuilder');

$process = $process_builder->setExecutable('/usr/bin/printenv')->setEnv('my_var', 'my_val')->build();
$process->mustRun();

return '<pre>' . kUtil::escape($process->getOutput(), kUtil::ESCAPE_HTML) . '</pre>';
  • confirm, that tag output contains all environment variables of PHP process (usually seen in $_ENV or $_SERVER) plus the my_var variable

Part 9

  • try creating 2 different processes from same instance of ProcessBuilder class by using $process_builder->reset() method before attempt to start building another process
  • confirm, that builder settings from 1st process have no impact on 2nd process

Diff Detail

Repository
rINP In-Portal
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

alex updated this revision to Diff 316.Sep 20 2015, 1:38 PM
alex retitled this revision from to INP-1484 - Connect "Symfony Process" component.
alex updated this object.
alex edited the test plan for this revision. (Show Details)
alex added 1 JIRA issue(s): INP-1484.
alex added a comment.Sep 21 2015, 2:20 AM

Maybe the ProcessHelper needs to be renamed to the ProcessBridge according to http://symfony.com/blog/new-in-symfony-2-7-phpunit-bridge.

alex planned changes to this revision.Sep 21 2015, 4:54 AM

Maybe I change this a lot into a ProcessBuilder instead.

alex updated this revision to Diff 318.Sep 21 2015, 3:02 PM
alex edited edge metadata.

Transformed ProcessHelper into ProcessBuilder.

alex edited the test plan for this revision. (Show Details)Sep 21 2015, 3:12 PM
alex edited the test plan for this revision. (Show Details)
alex edited the test plan for this revision. (Show Details)
alex updated this revision to Diff 319.Sep 23 2015, 8:39 AM

Added reset method.

alex edited the test plan for this revision. (Show Details)Sep 23 2015, 8:41 AM
glebs accepted this revision.Sep 25 2015, 2:00 AM
glebs edited edge metadata.
This revision is now accepted and ready to land.Sep 25 2015, 2:01 AM
This revision was automatically updated to reflect the committed changes.
alex added a comment.Sep 27 2015, 7:08 AM

After http://qa.in-portal.org/D137?vs=318&id=319&whitespace=ignore-most#toc change I'm getting Use setCommand() or setExecutable(), not both. exception on every build() method call.

@glebs, haven't you tested the diff before the reset method was added and then just tested only reset method instead of whole thing?

glebs reopened this revision.Sep 28 2015, 1:47 AM
This revision is now accepted and ready to land.Sep 28 2015, 1:47 AM
glebs resigned from this revision.Sep 28 2015, 1:48 AM
glebs removed a reviewer: glebs.
This revision now requires review to proceed.Sep 28 2015, 1:48 AM
glebs added a reviewer: glebs.Sep 28 2015, 1:48 AM
glebs accepted this revision.Sep 28 2015, 2:10 AM
glebs edited edge metadata.
This revision is now accepted and ready to land.Sep 28 2015, 2:10 AM
glebs closed this revision.Sep 28 2015, 2:11 AM