Security update for permissions_by_term
[yaffs-website] / vendor / behat / mink-extension / src / Behat / MinkExtension / ServiceContainer / Driver / ZombieFactory.php
1 <?php
2
3 /*
4  * This file is part of the Behat MinkExtension.
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\MinkExtension\ServiceContainer\Driver;
12
13 use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
14 use Symfony\Component\DependencyInjection\Definition;
15
16 class ZombieFactory implements DriverFactory
17 {
18     /**
19      * {@inheritdoc}
20      */
21     public function getDriverName()
22     {
23         return 'zombie';
24     }
25
26     /**
27      * {@inheritdoc}
28      */
29     public function supportsJavascript()
30     {
31         return true;
32     }
33
34     /**
35      * {@inheritdoc}
36      */
37     public function configure(ArrayNodeDefinition $builder)
38     {
39         $builder
40             ->children()
41                 ->scalarNode('host')->defaultValue('127.0.0.1')->end()
42                 ->scalarNode('port')->defaultValue(8124)->end()
43                 ->scalarNode('node_bin')->defaultValue('node')->end()
44                 ->scalarNode('server_path')->defaultNull()->end()
45                 ->scalarNode('threshold')->defaultValue(2000000)->end()
46                 ->scalarNode('node_modules_path')->defaultValue('')->end()
47             ->end()
48         ;
49     }
50
51     /**
52      * {@inheritdoc}
53      */
54     public function buildDriver(array $config)
55     {
56         if (!class_exists('Behat\Mink\Driver\ZombieDriver')) {
57             throw new \RuntimeException(
58                 'Install MinkZombieDriver in order to use zombie driver.'
59             );
60         }
61
62         return new Definition('Behat\Mink\Driver\ZombieDriver', array(
63             new Definition('Behat\Mink\Driver\NodeJS\Server\ZombieServer', array(
64                 $config['host'],
65                 $config['port'],
66                 $config['node_bin'],
67                 $config['server_path'],
68                 $config['threshold'],
69                 $config['node_modules_path'],
70             )),
71         ));
72     }
73 }