Download the PHP package nucivic/dkanextension without Composer
On this page you can find all versions of the php package nucivic/dkanextension. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package dkanextension
DEPRECATED: This module has been moved into DKAN core for release 7.x-1.13. To maintain backward compatibility this project will remain on Github but new features will be applied directly to the DKAN core folder test/dkanextension
.
Behat DKAN Context
This creates a feature context for DKAN and NuCivic specific steps.
Install
-
Create a
composer.json
file with the following: -
Install dependencies:
composer install
- Initialize:
behat --init
Contexts
DKANExtension ships with a bunch of "Contexts" or Classes that Behat uses to add step functions or other functionality. By default, none of those contexts are loaded. You need to add each context that you want to use to your behat.yml
file. Here is an example where we add all the contexts, but you can instead choose to only load the ones you want. This can be very useful if you want to override one of these contexts and use your custom version instead. If you've used the DrupalExtension, which DKANExtension depends on, it works the same way.
Setting up your behat.yml
Contexts Available
All contexts are in the src/Drupal/DKANExtension/Context folder. We're only showing the contexts that you'll consider loading in your behat.yml and only the custom steps they provide.
DKANContext.php
The generic context that holds some helper steps
- Sets the default php timezone to
date_default_timezone_set('America/New_York');
@When I search for :term
@Then /^I should see the administration menu$/
@Then /^I should have an "([^"]*)" text format option$/
DKANDataStoryContext.php
Extends RawDKANEntityContext
-
@Given data stories:
Examples:
DataDashboardContext.php
Extends RawDKANEntityContext
-
@Given data dashboards:
Examples:
DatasetContext.php
Extends RawDKANEntityContext
-
@Given datasets:
Examples:
-
@Then I should see a dataset called :text
:text
- Title of the dataset (string)
Examples:
-
@Then the Dataset search updates behind the scenes
(Deprecated)
GroupContext.php
Extends RawDKANEntityContext
-
@Given groups:
Examples:
-
@Given group memberships:
Assigns users as members of a group with specific roles.
Examples:
-
@Given /^I am a "([^"]*)" of the group "([^"]*)"$/
Grants the given role to the current user, for the given group.
:role
- role on group. See@Given group memberships:
:group
- Group name (string)
Examples:
MailContext.php
- Creates the @mail tag for use when testing email notifications in your scenario
(currently no additinal steps)
PageContext.php
-
@Given pages:
Examples:
-
@Given I am on (the) :page page
Changes the current page. Knows about pages created by other contexts, like GroupContext as well.
:page
- title of the page created by@Given Pages
or one of the other contexts that integrate with PageContext.
Examples:
Manually Created Pages:
Use pages created by other contexts.
ResourceContext.php
Extends RawDKANEntityContext
@Given resources:
About RawDKANEntityContext
RawDKANEntityContext is a base Class that the other Content/Entity contexts extend from. It can be used to easily create new contexts for content that have a following features:
- Automatic Deletion of content on teardown.
- Handles any entity (nodes+)
- Creates "pages" in the PageContext so that you can navigate to an item after it's created.
- Handles mapping of "human" field labels to drupal field names and handles adding entities with Tables.
- Handles author mapping of username to uid.
- Uses entity api metadata wrappers throughout, making it easier to set fields in a consistent way.
- Keeps a list of created entities in $entities[$id] for teardown and other uses like finding an entity by name.
You should use the existing "entity contexts", or create a new one for your project instead of the DrupalExtension's @Given content:
which lacks most of these features. Because the entity api needs to be bootstrapped, you can only use the 'drupal driver', not 'drush' or 'blackbox' when using relevant steps.
Creating a new Entity Context
To create a new Context for any entity (and nodes), create a new context in your /bootstrap folder. For this example, we'll pretend the entity is a node type called "myentity". Call the file MyEntityContext.php (where MyEntity is the name of your entity.) You can use this template to get started.
Now add the new Entity Context to your behat.yml like you'd do for any new custom context:
TODO
- [ ] Make sure scripts works on install
- [ ] Add tests
- [ ] Deploy on DKAN and related modules