Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / vendor / behat / mink-goutte-driver / src / GoutteDriver.php
1 <?php
2
3 /*
4  * This file is part of the Behat\Mink.
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\Mink\Driver;
12
13 use Behat\Mink\Driver\Goutte\Client as ExtendedClient;
14 use Goutte\Client;
15
16 /**
17  * Goutte driver.
18  *
19  * @author Konstantin Kudryashov <ever.zet@gmail.com>
20  */
21 class GoutteDriver extends BrowserKitDriver
22 {
23     /**
24      * Initializes Goutte driver.
25      *
26      * @param Client $client Goutte client instance
27      */
28     public function __construct(Client $client = null)
29     {
30         parent::__construct($client ?: new ExtendedClient());
31     }
32
33     /**
34      * {@inheritdoc}
35      */
36     public function setBasicAuth($user, $password)
37     {
38         if (false === $user) {
39             $this->getClient()->resetAuth();
40
41             return;
42         }
43
44         $this->getClient()->setAuth($user, $password);
45     }
46
47     /**
48      * Gets the Goutte client.
49      *
50      * The method is overwritten only to provide the appropriate return type hint.
51      *
52      * @return Client
53      */
54     public function getClient()
55     {
56         return parent::getClient();
57     }
58
59     /**
60      * {@inheritdoc}
61      */
62     public function reset()
63     {
64         parent::reset();
65         $this->getClient()->resetAuth();
66     }
67
68     /**
69      * {@inheritdoc}
70      */
71     protected function prepareUrl($url)
72     {
73         return $url;
74     }
75 }