Skip to content

Commit

Permalink
Merge pull request #358 from arlina-espinoza/341-enable-kernel-functi…
Browse files Browse the repository at this point in the history
…onal-tests

[#341] Enable kernel, functional, and functional JS tests
  • Loading branch information
shadcn authored Mar 17, 2020
2 parents f416c8c + e7fc6b9 commit e8d72db
Show file tree
Hide file tree
Showing 17 changed files with 155 additions and 263 deletions.
6 changes: 2 additions & 4 deletions .circleci/RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public function setupSkeleton()
// composer config doesn't allow us to set arrays, so we have to do this by
// hand.
$config = json_decode(file_get_contents('composer.json'));
$config->require->{"drush/drush"} = "~9.0";
$config->extra->{"enable-patching"} = 'true';
$config->extra->{"patches"} = new \stdClass();
file_put_contents('composer.json', json_encode($config));
Expand Down Expand Up @@ -81,9 +80,8 @@ public function addCodingStandardsDeps()
public function addBehatDeps()
{
$config = json_decode(file_get_contents('composer.json'));
$config->require->{"behat/mink-selenium2-driver"} = "^1.3";
// Package behat/mink-selenium2-driver is included in drupal/core-dev.
$config->require->{"drupal/drupal-extension"} = "master-dev";
$config->require->{"drush/drush"} = "~9.0";
$config->require->{"guzzlehttp/guzzle"} = "^6.0@dev";
file_put_contents('composer.json', json_encode($config));
}
Expand Down Expand Up @@ -410,7 +408,7 @@ public function configureModuleDependencies()
$config = json_decode(file_get_contents('composer.json'));

// The Drupal core image might need updating. Request the newest stable.
$config->require->{"drupal/core"} = "~8.8";
unset($config->require->{"drupal/core"});
$config->require->{"drupal/core-recommended"} = "~8.8";

// We require Drupal console and drush for some tests.
Expand Down
21 changes: 11 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,19 +193,20 @@ jobs:
workflows:
version: 2

# Declare a workflow that runs all of our jobs in parallel.
# Declare a workflow that runs jobs in parallel.
# Functional JS tests need to run after functional due to a conflict in apigee_edge_apiproduct_rbac tests.
test_and_lint:
jobs:
- update-dependencies
# - run-unit-kernel-tests:
# requires:
# - update-dependencies
# - run-functional-tests:
# requires:
# - update-dependencies
# - run-functional-js-tests:
# requires:
# - update-dependencies
- run-unit-kernel-tests:
requires:
- update-dependencies
- run-functional-tests:
requires:
- update-dependencies
- run-functional-js-tests:
requires:
- update-dependencies
- run-code-sniffer:
requires:
- update-dependencies
Expand Down
3 changes: 0 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@
},
"require-dev": {
"apigee/apigee-mock-client-php": "^1.0",
"behat/mink" : "dev-master#9ea1cebe",
"behat/mink-extension": "v2.2",
"behat/mink-selenium2-driver": "1.3.x-dev",
"bex/behat-screenshot": "^1.2",
"cweagans/composer-patches": "^1.6",
"drupal/coder": "^8.3",
"drupal/core-dev": "^8.7",
"drupal/drupal-extension": "master-dev",
"drush/drush": "^9.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* MA 02110-1301, USA.
*/

namespace Drupal\Tests\apigee_edge_apiproduct_rbac\Functional;
namespace Drupal\Tests\apigee_edge_apiproduct_rbac\FunctionalJavascript;

use Drupal\Core\Session\AccountInterface;

Expand Down Expand Up @@ -46,8 +46,8 @@ protected function setUp() {
/**
* {@inheritdoc}
*
* \Drupal\Tests\apigee_edge\Functional\ApiProductAccessTest validates
* developerAppEditFormTest().
* \Drupal\Tests\apigee_edge\FunctionalJavascript\ApiProductAccessTest
* validates developerAppEditFormTest().
*/
public function testApiProductAccess() {
$this->entityAccessTest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* MA 02110-1301, USA.
*/

namespace Drupal\Tests\apigee_edge_apiproduct_rbac\Functional;
namespace Drupal\Tests\apigee_edge_apiproduct_rbac\FunctionalJavascript;

use Drupal\Core\Session\AccountInterface;

Expand Down Expand Up @@ -46,8 +46,8 @@ protected function setUp() {
/**
* {@inheritdoc}
*
* \Drupal\Tests\apigee_edge\Functional\ApiProductAccessTest validates
* developerAppEditFormTest().
* \Drupal\Tests\apigee_edge\FunctionalJavascript\ApiProductAccessTest
* validates developerAppEditFormTest().
*/
public function testApiProductAccess() {
$this->entityAccessTest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* MA 02110-1301, USA.
*/

namespace Drupal\Tests\apigee_edge_apiproduct_rbac\Functional;
namespace Drupal\Tests\apigee_edge_apiproduct_rbac\FunctionalJavascript;

use Drupal\Core\Session\AccountInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* MA 02110-1301, USA.
*/

namespace Drupal\Tests\apigee_edge_apiproduct_rbac\Functional;
namespace Drupal\Tests\apigee_edge_apiproduct_rbac\FunctionalJavascript;

use Drupal\Core\Session\AccountInterface;

Expand All @@ -39,8 +39,8 @@ class ApiProductRoleBasedAccessMissingAttributeTest extends ApiProductRoleBasedA
/**
* {@inheritdoc}
*
* \Drupal\Tests\apigee_edge\Functional\ApiProductAccessTest validates
* developerAppEditFormTest().
* \Drupal\Tests\apigee_edge\FunctionalJavascript\ApiProductAccessTest
* validates developerAppEditFormTest().
*/
public function testApiProductAccess() {
$this->entityAccessTest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
* MA 02110-1301, USA.
*/

namespace Drupal\Tests\apigee_edge_apiproduct_rbac\Functional;
namespace Drupal\Tests\apigee_edge_apiproduct_rbac\FunctionalJavascript;

use Drupal\apigee_edge\Entity\ApiProductInterface;
use Drupal\Core\Url;
use Drupal\Tests\apigee_edge\Functional\ApiProductAccessTest;
use Drupal\Tests\apigee_edge\FunctionalJavascript\ApiProductAccessTest;
use Drupal\user\UserInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public function testTeamApiProductAccess() {
// we do not need to validate the developer app/edit forms because those
// are covered by the parent module's ApiProductAccessTest which ensures
// the API product list is filtered properly there.
// \Drupal\Tests\apigee_edge\Functional\ApiProductAccessTest.
// \Drupal\Tests\apigee_edge\FunctionalJavascript\ApiProductAccessTest.
$this->drupalLogout();
// <<< Team member.
// If team member gets removed from the team its API Product access
Expand Down
35 changes: 0 additions & 35 deletions tests/modules/apigee_mock_api_client/apigee_mock_api_client.module

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
use Apigee\MockClient\Generator\ApigeeSdkEntitySource;
use Drupal\apigee_edge\Entity\Developer;
use Drupal\apigee_edge\Entity\DeveloperInterface;
use Drupal\apigee_mock_api_client\Plugin\KeyProvider\TestEnvironmentVariablesKeyProvider;
use Drupal\key\Entity\Key;
use Drupal\Tests\apigee_edge\Traits\ApigeeEdgeUtilTestTrait;
use Drupal\user\UserInterface;
use Http\Message\RequestMatcher\RequestMatcher;

Expand All @@ -34,6 +33,8 @@
*/
trait ApigeeMockApiClientHelperTrait {

use ApigeeEdgeUtilTestTrait;

/**
* The SDK connector service.
*
Expand Down Expand Up @@ -69,13 +70,6 @@ trait ApigeeMockApiClientHelperTrait {
*/
protected $integration_enabled;

/**
* The Apigee Edge key used in tests.
*
* @var string
*/
protected $apigee_edge_test_key = 'apigee_edge_test_auth';

/**
* Setup.
*/
Expand All @@ -101,32 +95,8 @@ protected function apigeeTestPropertiesSetup() {
* @throws \Drupal\Core\Entity\EntityStorageException
*/
protected function initAuth() {

// Create new Apigee Edge basic auth key.
$key = Key::create([
'id' => $this->apigee_edge_test_key,
'label' => 'Apigee Test Authorization',
'key_type' => 'apigee_auth',
'key_provider' => 'apigee_edge_environment_variables',
'key_input' => 'apigee_auth_input',
]);

$key->save();

// Collect credentials from environment variables.
$fields = [];
foreach (array_keys($key->getKeyType()->getPluginDefinition()['multivalue']['fields']) as $field) {
$id = 'APIGEE_EDGE_' . strtoupper($field);
if ($value = getenv($id)) {
$fields[$id] = $value;
}
}
// Make sure the credentials persists for functional tests.
\Drupal::state()->set(TestEnvironmentVariablesKeyProvider::KEY_VALUE_STATE_ID, $fields);

$this->config('apigee_edge.auth')
->set('active_key', $this->apigee_edge_test_key)
->save();
$this->createTestKey();
$this->restoreKey();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* MA 02110-1301, USA.
*/

namespace Drupal\Tests\apigee_edge\Functional;
namespace Drupal\Tests\apigee_edge\FunctionalJavascript;

use Apigee\Edge\Api\Management\Entity\App;
use Drupal\apigee_edge\Entity\ApiProduct;
Expand All @@ -37,7 +37,7 @@
* @group apigee_edge_api_product
* @group apigee_edge_api_product_access
*/
class ApiProductAccessTest extends ApigeeEdgeFunctionalTestBase {
class ApiProductAccessTest extends ApigeeEdgeFunctionalJavascriptTestBase {

protected const USER_WITH_BYPASS_PERM = 'user_with_bypass_perm';
protected const INTERNAL_ROLE = 'internal';
Expand Down
Loading

0 comments on commit e8d72db

Please sign in to comment.