Security update for permissions_by_term
[yaffs-website] / vendor / behat / behat / src / Behat / Testwork / Hook / Tester / Setup / HookedSetup.php
diff --git a/vendor/behat/behat/src/Behat/Testwork/Hook/Tester/Setup/HookedSetup.php b/vendor/behat/behat/src/Behat/Testwork/Hook/Tester/Setup/HookedSetup.php
new file mode 100644 (file)
index 0000000..3ba4478
--- /dev/null
@@ -0,0 +1,73 @@
+<?php
+
+/*
+ * This file is part of the Behat.
+ * (c) Konstantin Kudryashov <ever.zet@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Behat\Testwork\Hook\Tester\Setup;
+
+use Behat\Testwork\Call\CallResults;
+use Behat\Testwork\Tester\Setup\Setup;
+
+/**
+ * Represents hooked test setup.
+ *
+ * @author Konstantin Kudryashov <ever.zet@gmail.com>
+ */
+final class HookedSetup implements Setup
+{
+    /**
+     * @var Setup
+     */
+    private $setup;
+    /**
+     * @var CallResults
+     */
+    private $hookCallResults;
+
+    /**
+     * Initializes setup.
+     *
+     * @param Setup       $setup
+     * @param CallResults $hookCallResults
+     */
+    public function __construct(Setup $setup, CallResults $hookCallResults)
+    {
+        $this->setup = $setup;
+        $this->hookCallResults = $hookCallResults;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function isSuccessful()
+    {
+        if ($this->hookCallResults->hasExceptions()) {
+            return false;
+        }
+
+        return $this->setup->isSuccessful();
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function hasOutput()
+    {
+        return $this->hookCallResults->hasStdOuts() || $this->hookCallResults->hasExceptions();
+    }
+
+    /**
+     * Returns hook call results.
+     *
+     * @return CallResults
+     */
+    public function getHookCallResults()
+    {
+        return $this->hookCallResults;
+    }
+}