Skip to content

Commit

Permalink
Merge branch '3.x' into rename_menu_title
Browse files Browse the repository at this point in the history
  • Loading branch information
shishir-intelli authored Jan 25, 2024
2 parents a39ec62 + 829dd6a commit b681d0b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 43 deletions.
42 changes: 16 additions & 26 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ This project follows [Google's Open Source Community Guidelines](https://opensou

## To start
* Fork this project on Github.
* If you do not have an Apigee Edge trial organization, create a new one
[here](https://login.apigee.com/login).
* Register on https://circleci.com using your GitHub account.
* If you do not have an Apigee Edge or X trial organization, create a new one
[here for Edge](https://login.apigee.com/login) or [X](https://apigee.google.com/).
* Setup [Github actions](https://docs.github.com/en/actions) using your GitHub account.
* Install the module from for your fork instead of Drupal.org on your local. (See below.)

## For daily work
* Create a new branch in your fork repository. It is best to name your branch something descriptive, ex.: issue-12.
* Add changes to the code. If you implement new features, add new
tests to cover the implemented functionality. If you modify existing features, update related tests.
* Push your changes to your repo's branch.
* Wait until all CircleCI test jobs finish and _pass_. (If any of them fails
restart them once or twice. They may have failed due to an API communication error. You can
* Wait until all Github Actions test jobs finish and _pass_. (If any of them fails
restart them once or twice. They may have failed due to an API communication error or caching issue. You can
identify these type of issues from logs.)
* Create [new pull request](https://github.com/apigee/apigee-edge-drupal/pull/new/8.x-1.x). CircleCI will
* Create [new pull request](https://github.com/apigee/apigee-edge-drupal/pull/new/3.x). Github Actions will
automatically report the status of each of the CI jobs directly to the GitHub PR.

## Installing module from your fork instead of Drupal.org
Expand All @@ -54,7 +54,7 @@ Update your composer.json and install the module from your fork:
```bash
cd [DRUPAL_ROOT]
composer config repositories.forked-apigee_edge vcs https://github.com/[YOUR-GITHUB-USERNAME]/apigee-edge-drupal
composer require drupal/apigee_edge:dev-issue-12 # It is important to require a branch/tag here that does not exist in the Drupal.org repo otherwise code gets pulled from there. For example, dev-8.x-1.x condition would pull the code from Drupal.org repo instead of your fork.
composer require drupal/apigee_edge:dev-issue-12 # It is important to require a branch/tag here that does not exist in the Drupal.org repo otherwise code gets pulled from there. For example, dev-3.x condition would pull the code from Drupal.org repo instead of your fork.
```

If you would like to keep your fork always up-to-date with recent changes in
Expand All @@ -72,7 +72,7 @@ upstream:
```bash
cd [DRUPAL_ROOT]/modules/contrib/apigee_edge
git fetch upstream
git rebase upstream/8.x-1.x
git rebase upstream/3.x
```

After you have installed the module from your fork you can easily create new
Expand All @@ -81,7 +81,7 @@ branches for new fixes on your local:
```bash
cd [DRUPAL_ROOT]/modules/contrib/apigee_edge
git fetch upstream
git checkout -b issue-12 upstream/8.x-1.x
git checkout -b issue-12 upstream/3.x

# Add your awesome changes.
# Do not forget to update tests or write additional test cases if needed.
Expand Down Expand Up @@ -112,7 +112,7 @@ need to be set on your system. These variables are:

Value of `APIGEE_EDGE_AUTH_TYPE` should be set to either 'basic' or 'oauth'. If you select `oauth` and have a SAML enabled org you will also need to set `APIGEE_EDGE_AUTHORIZATION_SERVER`, `APIGEE_EDGE_CLIENT_ID`, `APIGEE_EDGE_CLIENT_SECRET` values.

Value of `APIGEE_EDGE_USERNAME` should be an email address of an Apigee Edge user with **Organization administrator role** if you do not want to bump into permission issues in tests. Tests failed with "Forbidden" could be a sign of the insufficient permissions.
Value of `APIGEE_EDGE_USERNAME` should be an email address of an Apigee Edge/X user with **Organization administrator role** if you do not want to bump into permission issues in tests. Tests failed with "Forbidden" could be a sign of the insufficient permissions.

You can set these environment variables in multiple ways:
- Copy the `phpunit.core.xml.dist` file included with this module as `core/phpunit.xml`. Uncomment the `APIGEE_*`
Expand All @@ -132,6 +132,7 @@ If you wish to run tests both against a Public and a Hybrid instance:
1. First configure the credentials to the public org as described above.
2. Add the `APIGEE_EDGE_ACCOUNT_JSON_KEY` environment variable.
3. Add a`APIGEE_EDGE_HYBRID_ORGANIZATION` environment variable, which specifies the Hybrid organization to use for tests.
4. Add the `APIGEE_EDGE_HYBRID_ENDPOINT` environment variable, which specifies the Hybrid/X endpoint to use for tests.

## Install development dependencies

Expand All @@ -154,28 +155,17 @@ cd [DRUPAL_ROOT]
./vendor/bin/phpunit -c core --verbose --color modules/contrib/apigee_edge/tests/src/Kernel/EntityControllerCacheTest.php
```

If you have CircleCI CLI and Docker installed on your system you can also run
PHPUnit tests with the following commands:

```bash
cd [DRUPAL_ROOT]/modules/contrib/apigee_edge/
circleci local execute --job [JOB_NAME]
```

- Note: Replace `[JOB_NAME]` with the name of the job that you want to run locally. Examples:
`run-unit-kernel-tests-8`, `run-functional-tests-9`, etc.

You can read more about running Drupal 8 PHPUnit tests [here](https://www.drupal.org/docs/8/phpunit/running-phpunit-tests).
You can read more about running Drupal 9 and above PHPUnit tests [here](https://www.drupal.org/docs/automated-testing/phpunit-in-drupal/running-phpunit-tests).

### Troubleshooting

**If a test is passing on your local, but it is failing on CircleCI:**
**If a test is passing on your local, but it is failing on Github Actions:**
1. Try to restart failing job(s) one or two times, failing tests could be caused by communication issues.
2. If (1) did not work, try to run the failing test(s) on your local with the above described CircleCI CLI.
2. If (1) did not work, try to run the failing test(s) on your local with the above described Github Actions CLI.

### If your pull request relies on changes that are not yet available in Apigee Edge Client Library for PHP's latest stable release
### If your pull request relies on changes that are not yet available in Apigee Client Library for PHP's latest stable release
You should *temporarily* add required changes as patches to module's composer.json.
This way this module's tests could pass on CircleCI.
This way this module's tests could pass on Github Actions.

#### Example:

Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Apigee Edge Drupal module
# Apigee Drupal module

The Apigee Edge module enables you to integrate Drupal 10 with Apigee.
The Apigee module enables you to integrate Drupal 10 with Apigee Edge or Apigee X.

* Users that register or are added to the Drupal site will be added as developers in Apigee.
* Click on "Apps" in user menu to get keys for the APIs exposed in Apigee.
Expand All @@ -10,7 +10,7 @@ This module includes the following submodules:
* __Debug:__ enables administrators to configure and manage Apigee debug logs.
* __Teams:__ enables developers to be organized into teams.

For more details read the [Apigee Edge module documentation](https://www.drupal.org/docs/contributed-modules/apigee-edge).
For more details read the [Apigee module documentation](https://www.drupal.org/docs/contributed-modules/apigee-edge).

## Support for Apigee Hybrid Cloud and Apigee X

Expand All @@ -24,15 +24,15 @@ Please note that the Monetization APIs are not currently supported on Apigee hyb

## Requirements

* The Apigee Edge module requires **Drupal 10.1.x** or higher and PHP 8.1, Drupal 10.x is recommended due to [Drupal 9's EOL timeline](https://www.drupal.org/docs/understanding-drupal/drupal-9-release-date-and-what-it-means/how-long-will-drupal-9-be-supported#s-drupal-9-support-will-end-in-november-2023).
* The Apigee module requires **Drupal 10.1.x** or higher and PHP 8.1, Drupal 10.x is recommended due to [Drupal 9's EOL timeline](https://www.drupal.org/docs/understanding-drupal/drupal-9-release-date-and-what-it-means/how-long-will-drupal-9-be-supported#s-drupal-9-support-will-end-in-november-2023).
* Drupal's minimum requirement is phpdocumentor/reflection-docblock:2.0.4 but at least 3.0 is required by this module. If you get the error "Your requirements could not be resolved to an installable set of packages" it may be because you are running reflection-docblock version 2. You can update `phpdocumentor/reflection-docblock` with the following command: `composer update phpdocumentor/reflection-docblock --with-dependencies`.
* **Check [composer.json](https://github.com/apigee/apigee-edge-drupal/blob/3.x/composer.json) for any required patches.** Patches prefixed with "(For testing)" are only required for running tests. Those are not necessary for using this module. Patches can be applied with the [cweagans/composer-patches](https://packagist.org/packages/cweagans/composer-patches) plugin automatically or manually. See [Applying Patches](#applying-patches) section below.
* (For developers) The locked commit from `behat/mink` library is required otherwise tests may fail. This caused by a Drupal core [bug](https://www.drupal.org/project/drupal/issues/2956279). See the related pull request for behat/mink [here](https://github.com/minkphp/Mink/pull/760).

## Installing

1. Install the Apigee Edge module using [Composer](https://getcomposer.org/).
Composer will download the Apigee Edge module and all its dependencies.
1. Install the Apigee module using [Composer](https://getcomposer.org/).
Composer will download the Apigee module and all its dependencies.
**Note**: Composer must be executed at the root of your Drupal installation.
For example:
```
Expand All @@ -42,24 +42,24 @@ Please note that the Monetization APIs are not currently supported on Apigee hyb

For more information about installing contributed modules using composer, see [the official documentation](https://www.drupal.org/docs/develop/using-composer/using-composer-to-manage-drupal-site-dependencies#managing-contributed).
2. Click **Extend** in the Drupal administration menu.
3. Select the **Apigee Edge** module.
3. Select the **Apigee** module.
4. Click **Install**.
5. Configure the [connection to your Apigee org](https://www.drupal.org/docs/contributed-modules/apigee-edge/configure-the-connection-to-apigee)

## Notes

* If you do not configure the connection between Drupal and Apigee, you will not be able to register developers on
the site and may cause other issues with Drupal core functions. If you do not plan to configure the connection between
Drupal and Apigee, you should uninstall the Apigee Edge module.
Drupal and Apigee, you should uninstall the Apigee module.
* When you first install the module, existing users in the Drupal site may not have a developer account in Apigee.
You can run [developer synchronization](https://www.drupal.org/docs/contributed-modules/apigee-edge/synchronize-developers-with-apigee-edge)
to make sure Drupal users and Apigee developers are synchronized.
* For migrating Apigee hybrid/ X Teams members in Drupal, you can run [Team synchronization](https://www.drupal.org/docs/contributed-modules/apigee-edge/synchronize-team-with-apigee-edge) to get the Team members information.

## Applying Patches

The Apigee Edge module may require Drupal core or contributed module patches to be able to work properly. These patches
can be applied automatically when Apigee Edge module gets installed but for that your Drupal installation must fulfill
The Apigee module may require Drupal core or contributed module patches to be able to work properly. These patches
can be applied automatically when Apigee module gets installed but for that your Drupal installation must fulfill
the following requirements:

1. [cweagans/composer-patches](https://packagist.org/packages/cweagans/composer-patches) >= 1.6.5 has to be installed.
Expand All @@ -69,11 +69,11 @@ has to be enabled in Drupal's composer.json.
3. Proper [patch level](https://github.com/cweagans/composer-patches/pull/101#issue-104810467)
for drupal/core has to be set in Drupal's composer.json.

You can find the currently required patches, if any, in the Apigee Edge module's [composer.json](https://github.com/apigee/apigee-edge-drupal/blob/3.x/composer.json)
You can find the currently required patches, if any, in the Apigee module's [composer.json](https://github.com/apigee/apigee-edge-drupal/blob/3.x/composer.json)
and in the Apigee PHP API Client's [composer.json](https://github.com/apigee/apigee-client-php/blob/3.x/composer.json).

**If you do not have all required patches applied in your Drupal installation you may experience some problems with the
Apigee Edge module.**
Apigee module.**

## Troubleshooting

Expand Down
4 changes: 2 additions & 2 deletions apigee_edge.info.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Apigee Edge
description: Apigee Edge Drupal integration.
name: Apigee
description: Apigee Drupal integration.
package: Apigee

type: module
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "drupal/apigee_edge",
"license": "GPL-2.0-or-later",
"type": "drupal-module",
"description": "Apigee Edge for Drupal.",
"description": "Apigee for Drupal.",
"require": {
"php": "~8.1.0 || ~8.2.0",
"ext-json": "*",
Expand Down
4 changes: 2 additions & 2 deletions tests/src/Kernel/UserAgentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function testUserAgentWithoutMonetization() {
$infoParser = new InfoParser($this->root);
$this->edgeModuleInfo = $infoParser->parse(\Drupal::service('module_handler')->getModule('apigee_edge')->getPathname());
if (!isset($this->edgeModuleInfo['version'])) {
$this->edgeModuleInfo['version'] = '2.x-dev';
$this->edgeModuleInfo['version'] = '3.x-dev';
}

$user_agent_parts[] = $this->edgeModuleInfo['name'] . '/' . $this->edgeModuleInfo['version'];
Expand All @@ -82,7 +82,7 @@ public function testUserAgentWithoutMonetization() {
\Drupal::moduleHandler()->invokeAll('apigee_edge_user_agent_string_alter', [&$user_agent_parts]);
$userAgentPrefix = implode('; ', $user_agent_parts);

$this->assertSame($userAgentPrefix, 'Apigee Edge/2.x-dev;' . ' Drupal/' . \Drupal::VERSION);
$this->assertSame($userAgentPrefix, 'Apigee/3.x-dev;' . ' Drupal/' . \Drupal::VERSION);
}

}

0 comments on commit b681d0b

Please sign in to comment.