Checks whether the command failed or passed, with output

@param string $result
@param PyStringNode $output

@Then /^it should (fail|pass) with:$/
359985
public function assertCommandResultWithOutput($result, PyStringNode $output) {
        $this->assertCommandResult($result);
        $this->assertCommandOutputMatches($output);
    }
212036
private void throwResult(final Result result) {
		this.executor.execute(new Runnable() {
			
			@Override
			public void run() {
				QConnectorAsyncImpl.this.listener.resultReceived("", result);
			}
		});
	}
134439
public function checkResult(Pjb62\Exception\JavaException $result): void
    {
        $exception = $this->getExceptionFromResult($result);
        throw $exception;
    }
537370
public static function batchFinished($success, $results, $operations) {
    // For some reason imported sessions (offerings) got status 13 instead of 1.
    // So update them manually or dive into the code and find the bug.
    $query = \Drupal::database()->update('node_field_data');
    $query->fields(['status' => '1']);
    $query->condition('status', 13);
    $query->execute();

    if ($success) {
      drupal_set_message(t('Great success!'));
    }
    else {
      $error_operation = reset($operations);
      drupal_set_message(t('An error occurred while processing @operation with arguments : @args', [ '@operation' => $error_operation[0], '@args' => print_r($error_operation[0], TRUE) ]));
    }
  }
462107
protected boolean isFailure(ExecutionResult result) {
    if (result.isNonResult())
      return false;
    else if (policy instanceof FailurePolicy)
      return ((FailurePolicy) policy).isFailure(result);
    else
      return result.getFailure() != null;
  }
470572
protected function onJobCompleted(string $result) : bool
    {
        $this->replySocket->send(json_encode([
            'request' => 'job_completed',
            'worker_id' => $this->workerId,
            'job_id' => $this->jobId,
            'result' => $result
        ]));
        $response = $this->replySocket->recv();
        $this->jobId = null;
        return ($response === 'ok');
    }
1195086
public function result(string $testName, int $result, string $message): void
	{
		$outputs = [
			Test::PASSED => Dumper::color('green', '✔ ' . $testName),
			Test::SKIPPED => Dumper::color('olive', 's ' . $testName) . '(' . $message . ')',
			Test::FAILED => Dumper::color('red', '✖ ' . $testName) . "\n" . $this->indent($message, 3) . "\n",
		];
		echo $this->indent($outputs[$result], 2) . PHP_EOL;
	}
446763
private function marshalFailedRoute(array $result): RouteResult
    {
        if ($result[0] === self::METHOD_NOT_ALLOWED) {
            return RouteResult::fromRouteFailure($result[1]);
        }

        return RouteResult::fromRouteFailure(RouteResult::HTTP_METHOD_ANY);
    }
988830
protected static function parseCharString(&$data, &$result)
    {
        // Character string type
        $data = self::parseCommon($data, $stringData);
        $result[] = [
            'string (' . self::$len . ')',
            self::printHex((string) $stringData), ];
    }
168994
public function itShouldFail($success)
    {
        if ('fail' === $success) {
            if (0 === $this->getExitCode()) {
                echo 'Actual output:'.PHP_EOL.PHP_EOL.$this->getOutput();
            }

            \PHPUnit_Framework_Assert::assertNotEquals(0, $this->getExitCode());
        } else {
            if (0 !== $this->getExitCode()) {
                echo 'Actual output:'.PHP_EOL.PHP_EOL.$this->getOutput();
            }

            \PHPUnit_Framework_Assert::assertEquals(0, $this->getExitCode());
        }
    }
1313501
public function output($line, $outcome, $status, $data) {
        global $OUTPUT;
        if ($this->outputmode == self::NO_OUTPUT) {
            return;
        }

        if ($this->outputmode == self::OUTPUT_PLAIN) {
            $message = array(
                $line,
                $outcome ? 'OK' : 'NOK',
                isset($data['id']) ? $data['id'] : '',
                isset($data['shortname']) ? $data['shortname'] : '',
                isset($data['fullname']) ? $data['fullname'] : '',
                isset($data['idnumber']) ? $data['idnumber'] : ''
            );
            $this->buffer->output(implode("\t", $message));
            if (!empty($status)) {
                foreach ($status as $st) {
                    $this->buffer->output($st, 1);
                }
            }
        } else if ($this->outputmode == self::OUTPUT_HTML) {
            $ci = 0;
            $this->rownb++;
            if (is_array($status)) {
                $status = implode(html_writer::empty_tag('br'), $status);
            }
            if ($outcome) {
                $outcome = $OUTPUT->pix_icon('i/valid', '');
            } else {
                $outcome = $OUTPUT->pix_icon('i/invalid', '');
            }
            echo html_writer::start_tag('tr', array('class' => 'r' . $this->rownb % 2));
            echo html_writer::tag('td', $line, array('class' => 'c' . $ci++));
            echo html_writer::tag('td', $outcome, array('class' => 'c' . $ci++));
            echo html_writer::tag('td', isset($data['id']) ? $data['id'] : '', array('class' => 'c' . $ci++));
            echo html_writer::tag('td', isset($data['shortname']) ? $data['shortname'] : '', array('class' => 'c' . $ci++));
            echo html_writer::tag('td', isset($data['fullname']) ? $data['fullname'] : '', array('class' => 'c' . $ci++));
            echo html_writer::tag('td', isset($data['idnumber']) ? $data['idnumber'] : '', array('class' => 'c' . $ci++));
            echo html_writer::tag('td', $status, array('class' => 'c' . $ci++));
            echo html_writer::end_tag('tr');
        }
    }
875518
private function wrapResponse(Response $response, $result = null, string $output = ''): Response
    {
        if ($result instanceof Response) {
            if (!empty($output) && $result->getBody()->isWritable()) {
                $result->getBody()->write($output);
            }

            return $result;
        }

        if (is_array($result) || $result instanceof \JsonSerializable) {
            $response = $this->writeJson($response, $result);
        } else {
            $response->getBody()->write($result);
        }

        //Always glue buffered output
        $response->getBody()->write($output);

        return $response;
    }
136028
public function theOutputShouldContain(PyStringNode $text)
    {
        PHPUnit_Framework_Assert::assertContains($this->getExpectedOutput($text), $this->getOutput());
    }
190452
private function checkResult($result)
    {
        if ($this->debug) {
            if (in_array($this->format, [self::FORMAT_JSON, self::FORMAT_JSONP])) {
                $result = json_decode($result, true);
            } elseif ($this->format == self::FORMAT_SERIAL) {
                $result = unserialize($result);
            }

            if (is_array($result)) {
                if (isset($result['success']) && $result['success'] == 0 && isset($result['error'])) {
                    throw new \Exception($result['error']);
                }
            }
        }
    }
967977
public function itShouldPassWith($success, PyStringNode $text)
    {
        $this->itShouldFail($success);
        $this->theOutputShouldContain($text);
    }
1160717
public function responseIsSuccessfullyWithContainScalarResult($result)
    {
        Assertions::assertEquals(200, $this->response->getStatusCode(), sprintf(
            'Response with error "%s"',
            $this->response->getBody()
        ));

        Assertions::assertTrue(is_null($this->response->getRpcErrorCode()), sprintf(
            'Response with error "%s"',
            $this->response->getBody()
        ));

        Assertions::assertEquals($result, $this->response->getRpcResult(), sprintf(
            'Result must be a contain "%s"',
            $result
        ));
    }
423046
@Override
    protected void recordResult(final RootNode node, final boolean success, final RootNodeExecutionContext context) {

        if (success) {
            if (log.isTraceEnabled()) {

                log.trace("node success");
            }

            node.getResult().setFinished();
            context.getNotificationDistributor().onNodeFinished(node);

        } else {

            final List<SubstepExecutionFailure> failures = context.getFailures();

            if (log.isDebugEnabled()) {

                log.debug("node failures");
            }

            // have a look at the constituent features
            List<FeatureNode> featureNodes = node.getChildren();
            boolean rootNodeStateSet = false;
            for (FeatureNode featureNode : node.getChildren()){

                if(featureNode.getResult().getResult() == ExecutionResult.FAILED && !featureNode.getResult().getFailure().isNonCritical()){
                    // we've got one valid feature failure, fail the root node
                    SubstepsRuntimeException e = new SubstepsRuntimeException("At least one critical Feature failed");
                    SubstepExecutionFailure sef = new SubstepExecutionFailure(e, node, ExecutionResult.FAILED);

                    context.getNotificationDistributor().onNodeFailed(node, e);
                    rootNodeStateSet = true;
                    break;
                }
            }

            if (!rootNodeStateSet){
                // got this far, must be ok
                node.getResult().setFinished();
                context.getNotificationDistributor().onNodeFinished(node);
            }


//            final Throwable lastException;
//            boolean nonCritical = false;
//            if (!failures.isEmpty()) {
//
//                final SubstepExecutionFailure lastFailure = failures.get(failures.size() - 1);
//                // just notify on the last one in..?
//                lastException = lastFailure.getCause();
//                node.getResult().setScreenshot(lastFailure.getScreenshot());
//                nonCritical = lastFailure.isNonCritical();
//            }
//            else {
//                lastException = new SubstepsRuntimeException("Error throw during startup, initialisation issue ?");
//                lastException.fillInStackTrace();
//                SubstepExecutionFailure sef = new SubstepExecutionFailure(lastException, node, ExecutionResult.FAILED);
//            }



//            SubstepExecutionFailure sef = new SubstepExecutionFailure(lastException, node, ExecutionResult.FAILED);
//            sef.setNonCritical(nonCritical);
//            context.getNotificationDistributor().onNodeFailed(node, lastException);

        }
    }