function backendCase::testBackendMethodPost

8.0.x backendTest.php backendCase::testBackendMethodPost()
6.x backendTest.php backendCase::testBackendMethodPost()
7.x backendTest.php backendCase::testBackendMethodPost()
5.x backendTest.php backendCase::testBackendMethodPost()
master backendTest.php backendCase::testBackendMethodPost()

Covers the following target responsibilities.

  • Insures that complex arrays can be passed through when using --backend mode's method POST
  • Insures that arrays can be returned as the function result of backend invoke.

File

tests/backendTest.php, line 196
We choose to test the backend system in two parts. - Origin. These tests assure that we are generate a proper ssh command when a backend invoke is needed. - Target. These tests assure that drush generates a delimited JSON array …

Class

backendCase

Code

function testBackendMethodPost() {
  $options = array(
    'backend' => NULL,
    'include' => dirname(__FILE__), // Find unit.drush.inc commandfile.
  );
  $php = "\$values = drush_invoke_process('@none', 'unit-return-options', array('value'), array('x' => 'y', 'strict' => 0, 'data' => array('a' => 1, 'b' => 2)), array('method' => 'POST')); return array_key_exists('object', \$values) ? \$values['object'] : 'no result';";
  $this->drush('php-eval', array($php), $options);
  $parsed = parse_backend_output($this->getOutput());
  // assert that $parsed has 'x' and 'data'
  $this->assertEquals(array(
    'x' => 'y',
    'data' => array(
      'a' => 1,
      'b' => 2,
    ),
  ), $parsed['object']);
}