Browser-Based VS Code Workflow¶
This page is for developers who want to use the hosted Visual Studio Code environment in DrupalForge / DevPanel to inspect code, make changes, and push work back to issue forks.
If you only need to open VS Code in the browser, use Working with Visual Studio Code in the Browser.
Find the Checked-Out Code¶
In the Visual Studio Code interface, the cloned repositories are available in
the repos/ directory.
You can find them either:
- from the file explorer in the left sidebar
- from the integrated terminal
Examples:
cd repos/ai
cd repos/ai_image_alt_text
When you make code changes there, they affect the running environment directly.
Push Changes Back to the Issue Fork¶
Configure your git identity in the terminal:
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
Create a GitLab Personal Access Token with write_repository permission.
Then:
- Change into the project repository inside
repos/ - Confirm the branch is the correct issue fork branch
- Commit your changes
- Run
git push <issue fork remote> <issue fork branch> - Use the personal access token as the password when prompted
Example:
cd repos/ai
git status
git branch --show-current
git add .
git commit -m "Issue #1234567: Fix thing"
git push <issue fork remote> <issue fork branch>
Using Drush¶
Run Drush from the project root:
./docroot/vendor/bin/drush
Running PHPUnit Tests¶
Copy docroot/web/core/phpunit.xml.dist to phpunit.xml, then open both
phpunit.xml and docroot/web/core/sites/default/settings.php.
It may help to use the editor's side-by-side view so you can compare the files while editing the PHPUnit settings.
In phpunit.xml:
- change the
bootstrapvalue todocroot/web/core/tests/bootstrap.php - change
SIMPLETEST_BASE_URLtohttp://localhost - change
SIMPLETEST_DBto match the database connection values fromsettings.php
The database string should look like:
mysql://username:password@host:port/database_name
Replace:
usernamewith the username valuepasswordwith the password valuehostwith the host valueportwith the port valuedatabase_namewith the database value
Then, from /var/www/html, run PHPUnit with the local config file:
docroot/vendor/bin/phpunit -c phpunit.xml <web/path/to/test>
Example:
docroot/vendor/bin/phpunit -c phpunit.xml web/core/modules/node/tests/src/Kernel/ConfigActionTest.php