4 * This file is part of the Behat.
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
11 namespace Behat\Testwork\Tester\Result;
13 use Behat\Testwork\Tester\Setup\Setup;
14 use Behat\Testwork\Tester\Setup\Teardown;
17 * Represents a test result with both setup and teardown attached.
19 * @author Konstantin Kudryashov <ever.zet@gmail.com>
21 final class TestWithSetupResult implements TestResult
37 * Initializes test result.
40 * @param TestResult $result
41 * @param Teardown $teardown
43 public function __construct(Setup $setup, TestResult $result, Teardown $teardown)
45 $this->setup = $setup;
46 $this->result = $result;
47 $this->teardown = $teardown;
53 public function isPassed()
55 return self::PASSED == $this->getResultCode();
61 public function getResultCode()
63 if (!$this->setup->isSuccessful()) {
67 if (!$this->teardown->isSuccessful()) {
71 return $this->result->getResultCode();