Security update for permissions_by_term
[yaffs-website] / vendor / behat / behat / src / Behat / Testwork / Hook / Tester / Setup / HookedSetup.php
1 <?php
2
3 /*
4  * This file is part of the Behat.
5  * (c) Konstantin Kudryashov <ever.zet@gmail.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 namespace Behat\Testwork\Hook\Tester\Setup;
12
13 use Behat\Testwork\Call\CallResults;
14 use Behat\Testwork\Tester\Setup\Setup;
15
16 /**
17  * Represents hooked test setup.
18  *
19  * @author Konstantin Kudryashov <ever.zet@gmail.com>
20  */
21 final class HookedSetup implements Setup
22 {
23     /**
24      * @var Setup
25      */
26     private $setup;
27     /**
28      * @var CallResults
29      */
30     private $hookCallResults;
31
32     /**
33      * Initializes setup.
34      *
35      * @param Setup       $setup
36      * @param CallResults $hookCallResults
37      */
38     public function __construct(Setup $setup, CallResults $hookCallResults)
39     {
40         $this->setup = $setup;
41         $this->hookCallResults = $hookCallResults;
42     }
43
44     /**
45      * {@inheritdoc}
46      */
47     public function isSuccessful()
48     {
49         if ($this->hookCallResults->hasExceptions()) {
50             return false;
51         }
52
53         return $this->setup->isSuccessful();
54     }
55
56     /**
57      * {@inheritdoc}
58      */
59     public function hasOutput()
60     {
61         return $this->hookCallResults->hasStdOuts() || $this->hookCallResults->hasExceptions();
62     }
63
64     /**
65      * Returns hook call results.
66      *
67      * @return CallResults
68      */
69     public function getHookCallResults()
70     {
71         return $this->hookCallResults;
72     }
73 }