X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FTestwork%2FSuite%2FGenericSuite.php;fp=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FTestwork%2FSuite%2FGenericSuite.php;h=766cffe5bd0e5cf915181eb7e4d491aa5daa07c4;hp=0000000000000000000000000000000000000000;hb=1270d9129ce8f27c9b28b10518e32132c58e0aca;hpb=c27c0f0cdaa3f354b1fe54a56ae7e854be6e3f68 diff --git a/vendor/behat/behat/src/Behat/Testwork/Suite/GenericSuite.php b/vendor/behat/behat/src/Behat/Testwork/Suite/GenericSuite.php new file mode 100644 index 000000000..766cffe5b --- /dev/null +++ b/vendor/behat/behat/src/Behat/Testwork/Suite/GenericSuite.php @@ -0,0 +1,96 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Behat\Testwork\Suite; + +use Behat\Testwork\Suite\Exception\ParameterNotFoundException; + +/** + * Represents generic (no specific attributes) test suite. + * + * @author Konstantin Kudryashov + */ +final class GenericSuite implements Suite +{ + /** + * @var string + */ + private $name; + /** + * @var array + */ + private $settings = array(); + + /** + * Initializes suite. + * + * @param string $name + * @param array $settings + */ + public function __construct($name, array $settings) + { + $this->name = $name; + $this->settings = $settings; + } + + /** + * Returns unique suite name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Returns suite settings. + * + * @return array + */ + public function getSettings() + { + return $this->settings; + } + + /** + * Checks if a setting with provided name exists. + * + * @param string $key + * + * @return Boolean + */ + public function hasSetting($key) + { + return array_key_exists($key, $this->settings); + } + + /** + * Returns setting value by its key. + * + * @param string $key + * + * @return mixed + * + * @throws ParameterNotFoundException If setting is not set + */ + public function getSetting($key) + { + if (!$this->hasSetting($key)) { + throw new ParameterNotFoundException(sprintf( + '`%s` suite does not have a `%s` setting.', + $this->getName(), + $key + ), $this->getName(), $key); + } + + return $this->settings[$key]; + } +}