File tree Expand file tree Collapse file tree 7 files changed +67
-3
lines changed
src/Drupal/MinkExtension/ServiceContainer Expand file tree Collapse file tree 7 files changed +67
-3
lines changed Original file line number Diff line number Diff line change 2727 - name : composer self-update
2828 run : docker-compose exec -T php composer self-update
2929 - name : composer require
30- run : docker-compose exec -u ${DOCKER_USER_ID} -T php composer require --no-interaction --dev --no-update drupal/core-recommended :^${DRUPAL_VERSION} drupal/core-composer-scaffold:^${DRUPAL_VERSION}
30+ run : docker-compose exec -u ${DOCKER_USER_ID} -T php composer require --no-interaction --dev --no-update drupal/core:^${DRUPAL_VERSION} drupal/core-composer-scaffold:^${DRUPAL_VERSION}
3131 - name : composer install
3232 run : docker-compose exec -T php composer install
3333 - name : drush site-install
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ drupal:
4646 extensions:
4747 Drupal\MinkExtension:
4848 base_url: http://drupal
49+ files_path: /var/www/html/fixtures/files
4950 Drupal\DrupalExtension:
5051 api_driver: "drupal"
5152 drupal:
Original file line number Diff line number Diff line change 2727 "behat/mink-browserkit-driver" : " ^2.1.0" ,
2828 "behat/mink-selenium2-driver" : " ~1.1" ,
2929 "drupal/drupal-driver" : " dev-master" ,
30- "symfony/http-client" : " ~4.4 || ^5 || ^6"
30+ "symfony/http-client" : " ~4.4 || ^5 || ^6" ,
31+ "webflo/drupal-finder" : " ^1.2"
3132 },
3233 "require-dev" : {
3334 "composer/installers" : " ^2" ,
3435 "drupal/coder" : " ^8.3" ,
3536 "drupal/core-composer-scaffold" : " ^9.4 || ^10.0" ,
36- "drupal/core-recommended " : " ^9.4 || ^10.0" ,
37+ "drupal/core" : " ^9.4 || ^10.0" ,
3738 "drush/drush" : " ^11.0" ,
3839 "php-parallel-lint/php-parallel-lint" : " ^1.3" ,
3940 "phpspec/phpspec" : " ^4.0 || ^6.0 || ^7.0"
Original file line number Diff line number Diff line change 1+ @api
2+ Feature : Upload test .
3+
4+ Scenario : Upload an image.
5+ Given I am logged in as a user with the "administrator" role
6+
7+ When I go to "/node/add/article"
8+ And I fill in "Title" with "This!"
9+ And I attach the file "image.png" to "files[field_image_0]"
10+ And I press "Upload"
11+ And I fill in "field_image[0][alt]" with "Nothing"
12+ And I press "Save"
13+ Then I should see the heading "This!"
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Drupal \MinkExtension \ServiceContainer \Driver ;
4+
5+ use Behat \MinkExtension \ServiceContainer \Driver \BrowserKitFactory as BrowserKitFactoryOriginal ;
6+ use Behat \Mink \Driver \BrowserKitDriver ;
7+ use DrupalFinder \DrupalFinder ;
8+ use Symfony \Component \DependencyInjection \Definition ;
9+
10+ class BrowserKitFactory extends BrowserKitFactoryOriginal
11+ {
12+ /**
13+ * {@inheritdoc}
14+ */
15+ public function buildDriver (array $ config ): Definition
16+ {
17+ if (!class_exists (BrowserKitDriver::class)) {
18+ throw new \RuntimeException (
19+ 'Install behat/mink-browserkit-driver in order to use the browserkit_http driver. '
20+ );
21+ }
22+
23+ $ drupalFinder = new DrupalFinder ();
24+ $ drupalFinder ->locateRoot (getcwd ());
25+ $ drupalRoot = $ drupalFinder ->getDrupalRoot ();
26+ require_once "$ drupalRoot/core/tests/Drupal/Tests/DrupalTestBrowser.php " ;
27+
28+ if (!class_exists ('Drupal\Tests\DrupalTestBrowser ' )) {
29+ throw new \RuntimeException (
30+ 'Class Drupal\Tests\DrupalTestBrowser not found '
31+ );
32+ }
33+
34+ return new Definition (BrowserKitDriver::class, [
35+ new Definition ('Drupal\Tests\DrupalTestBrowser ' ),
36+ '%mink.base_url% ' ,
37+ ]);
38+ }
39+ }
Original file line number Diff line number Diff line change 33namespace Drupal \MinkExtension \ServiceContainer ;
44
55use Behat \MinkExtension \ServiceContainer \MinkExtension as BaseMinkExtension ;
6+ use Drupal \MinkExtension \ServiceContainer \Driver \BrowserKitFactory ;
67use Symfony \Component \Config \Definition \Builder \ArrayNodeDefinition ;
78
89class MinkExtension extends BaseMinkExtension
@@ -15,6 +16,15 @@ class MinkExtension extends BaseMinkExtension
1516 */
1617 const AJAX_TIMEOUT = 5 ;
1718
19+ /**
20+ * {@inheritdoc}
21+ */
22+ public function __construct ()
23+ {
24+ parent ::__construct ();
25+ $ this ->registerDriverFactory (new BrowserKitFactory ());
26+ }
27+
1828 /**
1929 * {@inheritdoc}
2030 */
You can’t perform that action at this time.
0 commit comments