/** * @covers Box\TestScribe\Renderers\ValueAssertionRenderer::generate */ public function testGenerateNotSupportedValueType() { // Setup mocks for the constructor of the class under test when required. $mockOutput0 = $this->shmock('\\Box\\TestScribe\\Output', function ($shmock) { // Keep track of the order of calls made on this mock. $shmock->order_matters(); // Mock all methods, return null by default unless overwritten by the expectations below. $shmock->dont_preserve_original_methods(); $shmock->disable_original_constructor(); $shmock->writeln('Assertion for a variable ( var1 ) with type ( resource ) is not supported yet.'); }); $mockObjectValueAssertionRenderer1 = $this->shmock('\\Box\\TestScribe\\Renderers\\ObjectValueAssertionRenderer', function ($shmock) { // Keep track of the order of calls made on this mock. $shmock->order_matters(); // Mock all methods, return null by default unless overwritten by the expectations below. $shmock->dont_preserve_original_methods(); $shmock->disable_original_constructor(); }); $mockScalarOrNullValueAssertionRenderer2 = $this->shmock('\\Box\\TestScribe\\Renderers\\ScalarOrNullValueAssertionRenderer', function ($shmock) { // Keep track of the order of calls made on this mock. $shmock->order_matters(); // Mock all methods, return null by default unless overwritten by the expectations below. $shmock->dont_preserve_original_methods(); $shmock->disable_original_constructor(); }); $objectUnderTest = new Renderers\ValueAssertionRenderer($mockOutput0, $mockObjectValueAssertionRenderer1, $mockScalarOrNullValueAssertionRenderer2); $handle = curl_init(); $executionResult = $objectUnderTest->generate('var1', $handle); $this->assertSame('', $executionResult, "The execution result should be an empty string."); curl_close($handle); }
/** * Generate the test method as a string. * * @param bool $shouldVerifyResult * * @param \Box\TestScribe\Execution\ExecutionResult $executionResult * * @return string */ public function genResultValidation($shouldVerifyResult, ExecutionResult $executionResult) { if ($shouldVerifyResult) { $resultValue = $executionResult->getResultValue(); $resultValidationStatements = $this->valueAssertionRenderer->generate('executionResult', $resultValue); $result = "// Validate the execution result.\n\n{$resultValidationStatements}"; } else { $result = ''; } return $result; }