Skip to content

Commit

Permalink
Merge pull request #30 from palantirnet/before-after-notupdated-excep…
Browse files Browse the repository at this point in the history
…tions

Update "I should see a :label field" methods for Drupal 8
  • Loading branch information
becw authored Aug 23, 2016
2 parents ef344dc + 135d94e commit 8893b7f
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 121 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ class DrupalAutoNodetitleContext extends SharedDrupalContext
*/
public function disableAutoNodetitle()
{
throw new NotUpdatedException();

$this->disableAutoNodetitle = true;

}//end disableAutoNodetitle()
Expand All @@ -59,7 +57,7 @@ public function disableAutoNodetitle()
*/
public function prepareAutoNodetitleNode(BeforeNodeCreateScope $scope)
{
throw new NotUpdatedException();
throw new NotUpdatedException('Method not yet updated for Drupal 8.');

if ($this->disableAutoNodetitle === true) {
$node = $scope->getEntity();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ class DrupalCommentContext extends SharedDrupalContext
*/
public function gatherContexts(BeforeScenarioScope $scope)
{
throw new NotUpdatedException();

$environment = $scope->getEnvironment();
$this->drupalContext = $environment->getContext('Drupal\DrupalExtension\Context\DrupalContext');

Expand All @@ -82,11 +80,14 @@ public function gatherContexts(BeforeScenarioScope $scope)
*/
public function checkDependencies(BeforeScenarioScope $scope)
{
throw new NotUpdatedException();
/*
@todo Update for Drupal 8
@see NotUpdatedException
if (module_exists('comment') === false) {
throw new \Exception('The Comment module is not available.');
}
if (module_exists('comment') === false) {
throw new \Exception('The Comment module is not available.');
}
*/

}//end checkDependencies()

Expand All @@ -100,12 +101,15 @@ public function checkDependencies(BeforeScenarioScope $scope)
*/
public function cleanComments()
{
throw new NotUpdatedException();
/*
@todo Update for Drupal 8
@see NotUpdatedException
// Remove any comments that were created.
foreach ($this->comments as $comment) {
comment_delete($comment->cid);
}
// Remove any comments that were created.
foreach ($this->comments as $comment) {
comment_delete($comment->cid);
}
*/

$this->comments = array();

Expand All @@ -127,7 +131,7 @@ public function cleanComments()
*/
protected function getAccount()
{
throw new NotUpdatedException();
throw new NotUpdatedException('Method not yet updated for Drupal 8.');

if (empty($this->drupalContext->user) === false) {
$account = user_load($this->drupalContext->user->uid);
Expand All @@ -154,7 +158,7 @@ protected function getAccount()
*/
protected function createComment($comment)
{
throw new NotUpdatedException();
throw new NotUpdatedException('Method not yet updated for Drupal 8.');

// Assign authorship if none exists and `author` is passed.
if (isset($comment->uid) === false && empty($comment->author) === false) {
Expand Down Expand Up @@ -211,7 +215,7 @@ protected function createComment($comment)
*/
protected function expandEntityFields($entity_type, \stdClass $entity)
{
throw new NotUpdatedException();
throw new NotUpdatedException('Method not yet updated for Drupal 8.');

$field_types = $this->getDriver()->getCore()->getEntityFieldTypes($entity_type);

Expand All @@ -238,7 +242,7 @@ protected function expandEntityFields($entity_type, \stdClass $entity)
*/
public function assertCommentsAreOpen($type, $title)
{
throw new NotUpdatedException();
throw new NotUpdatedException('Method not yet updated for Drupal 8.');

$node = $this->getNodeByTitle($type, $title);
if ((int) $node->comment !== COMMENT_NODE_OPEN) {
Expand All @@ -261,7 +265,7 @@ public function assertCommentsAreOpen($type, $title)
*/
function createCommentOnContent($text, $type, $title)
{
throw new NotUpdatedException();
throw new NotUpdatedException('Method not yet updated for Drupal 8.');

$this->assertCommentsAreOpen($type, $title);

Expand Down Expand Up @@ -298,7 +302,7 @@ function createCommentOnContent($text, $type, $title)
*/
public function createCommentsOnContent($type, $title, TableNode $commentsTable)
{
throw new NotUpdatedException();
throw new NotUpdatedException('Method not yet updated for Drupal 8.');

$this->assertCommentsAreOpen($type, $title);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class DrupalFileContext extends SharedDrupalContext
*/
public function createFile($filename, $status = 1)
{
throw new NotUpdatedException();
throw new NotUpdatedException('Method not yet updated for Drupal 8.');

$file = (object) array(
'filename' => $filename,
Expand Down Expand Up @@ -60,7 +60,7 @@ public function createFile($filename, $status = 1)
*/
public function createFiles(TableNode $filesTable)
{
throw new NotUpdatedException();
throw new NotUpdatedException('Method not yet updated for Drupal 8.');

foreach ($filesTable->getHash() as $fileHash) {
$file = (object) $fileHash;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ class DrupalOrganicGroupsContext extends SharedDrupalContext
*/
public function gatherContexts(BeforeScenarioScope $scope)
{
throw new NotUpdatedException();

$environment = $scope->getEnvironment();
$this->drupalContext = $environment->getContext('Drupal\DrupalExtension\Context\DrupalContext');

Expand All @@ -65,11 +63,14 @@ public function gatherContexts(BeforeScenarioScope $scope)
*/
public function checkDependencies(BeforeScenarioScope $scope)
{
throw new NotUpdatedException();
/*
@todo Update for Drupal 8
@see NotUpdatedException
if (module_exists('og') === false) {
throw new \Exception('The Organic Groups module is not installed.');
}
if (module_exists('og') === false) {
throw new \Exception('The Organic Groups module is not installed.');
}
*/

}//end checkDependencies()

Expand All @@ -85,7 +86,7 @@ public function checkDependencies(BeforeScenarioScope $scope)
*/
protected function getAccount()
{
throw new NotUpdatedException();
throw new NotUpdatedException('Method not yet updated for Drupal 8.');

if (empty($this->drupalContext->user) === false) {
$account = user_load($this->drupalContext->user->uid);
Expand Down Expand Up @@ -114,7 +115,7 @@ protected function getAccount()
*/
public function assertGroupRole($group_role, $group_node_type, $group_node_title)
{
throw new NotUpdatedException();
throw new NotUpdatedException('Method not yet updated for Drupal 8.');

$this->drupalContext->assertAuthenticatedByRole('authenticated user');

Expand Down Expand Up @@ -161,7 +162,7 @@ public function assertGroupRole($group_role, $group_node_type, $group_node_title
*/
public function assertHasGroupRole($group_role, $group_node_type, $group_node_title)
{
throw new NotUpdatedException();
throw new NotUpdatedException('Method not yet updated for Drupal 8.');

$group_node = $this->findNodeByTitle($group_node_type, $group_node_title);

Expand All @@ -188,7 +189,7 @@ public function assertHasGroupRole($group_role, $group_node_type, $group_node_ti
*/
public function assertNodeIsGroup($type, $title)
{
throw new NotUpdatedException();
throw new NotUpdatedException('Method not yet updated for Drupal 8.');

$node = $this->findNodeByTitle($type, $title);

Expand All @@ -214,7 +215,7 @@ public function assertNodeIsGroup($type, $title)
*/
public function assertCreateGroupContent($type, $group_type, $group_title)
{
throw new NotUpdatedException();
throw new NotUpdatedException('Method not yet updated for Drupal 8.');

$this->assertGroupContent($type, $group_type, $group_title);

Expand Down Expand Up @@ -242,7 +243,7 @@ public function assertCreateGroupContent($type, $group_type, $group_title)
*/
public function assertNotCreateGroupContent($type, $group_type, $group_title)
{
throw new NotUpdatedException();
throw new NotUpdatedException('Method not yet updated for Drupal 8.');

$this->assertGroupContent($type, $group_type, $group_title);

Expand All @@ -267,7 +268,7 @@ public function assertNotCreateGroupContent($type, $group_type, $group_title)
*/
public function assertEditGroupContent($type, $group_type, $group_title)
{
throw new NotUpdatedException();
throw new NotUpdatedException('Method not yet updated for Drupal 8.');

$this->assertGroupContent($type, $group_type, $group_title);

Expand All @@ -292,7 +293,7 @@ public function assertEditGroupContent($type, $group_type, $group_title)
*/
public function assertNotEditGroupContent($type, $group_type, $group_title)
{
throw new NotUpdatedException();
throw new NotUpdatedException('Method not yet updated for Drupal 8.');

$this->assertGroupContent($type, $group_type, $group_title);

Expand All @@ -318,7 +319,7 @@ public function assertNotEditGroupContent($type, $group_type, $group_title)
*/
protected function assertGroupContent($type, $group_type, $group_title)
{
throw new NotUpdatedException();
throw new NotUpdatedException('Method not yet updated for Drupal 8.');

if (og_is_group_content_type('node', $type) === false) {
throw new \Exception(sprintf('Content of type "%s" can not be added to any group because it is not a group content type.'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class DrupalSetupContext extends SharedDrupalContext
*/
public function assertDrupal()
{
throw new NotUpdatedException();
throw new NotUpdatedException('Method not yet updated for Drupal 8.');

if ($this->getDriver()->isBootstrapped() === false) {
throw new \Exception('The Drupal site is not bootstrapped.');
Expand All @@ -45,7 +45,7 @@ public function assertDrupal()
*/
public function assertModuleInstalled($module)
{
throw new NotUpdatedException();
throw new NotUpdatedException('Method not yet updated for Drupal 8.');

if (module_exists($module) === false) {
throw new \Exception(sprintf('The "%s" module is not installed.', $module));
Expand All @@ -63,7 +63,7 @@ public function assertModuleInstalled($module)
*/
public function assertDefaultDrupalFeatures()
{
throw new NotUpdatedException();
throw new NotUpdatedException('Method not yet updated for Drupal 8.');

$this->assertModuleInstalled('features');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class DrupalWorkbenchModerationContext extends SharedDrupalContext
*/
public function disableWorkbenchModeration()
{
throw new NotUpdatedException();

$this->disableWorkbenchModeration = true;

}//end disableWorkbenchModeration()
Expand All @@ -58,7 +56,7 @@ public function disableWorkbenchModeration()
*/
public function prepareWorkbenchModerationNode(BeforeNodeCreateScope $scope)
{
throw new NotUpdatedException();
throw new NotUpdatedException('Method not yet updated for Drupal 8.');

if ($this->disableWorkbenchModeration === true) {
$node = $scope->getEntity();
Expand Down
Loading

0 comments on commit 8893b7f

Please sign in to comment.