Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

Commit

Permalink
PLAT-356: Upgrade devel module to latest commit id. (#380)
Browse files Browse the repository at this point in the history
* PLAT-356: Upgrade devel module to latest commit id.

* PLAT-356: Add updated files
  • Loading branch information
mrtstaunton authored and Saphyel committed Jul 25, 2016
1 parent dc18afb commit cfeba9a
Show file tree
Hide file tree
Showing 118 changed files with 376 additions and 630 deletions.
2 changes: 1 addition & 1 deletion profiles/cr/drupal-org.make.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ projects:
devel:
download:
version: 1.x-dev
revision: 5c6a506
revision: b8bcdc6
stage_file_proxy:
version: 1.0-alpha1
imagemagick:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php

/**
* @file
* Contains \Unish\DevelGenerateUnishTest.
*/

namespace Unish;

if (class_exists('Unish\CommandUnishTestCase')) {
Expand Down Expand Up @@ -75,6 +70,59 @@ public function testDevelGenerateTerms() {
$this->assertContains('Created the following new terms:', $this->getErrorOutput());
}

/**
* Tests devel generate contents.
*/
public function testDevelGenerateContents() {
$this->drush('pm-enable', ['node'], $this->getOptions());

$eval_content_count = "return \\Drupal::entityQuery('node')->count()->execute();";
$eval_options = $this->getOptions() + ['format' => 'string'];

// Try to generate 10 content of type "page" or "article"
$this->drush('generate-content', [10], $this->getOptions(), NULL, NULL, static::EXIT_SUCCESS);
$this->assertContains('Finished creating 10 nodes', $this->getErrorOutput());
$this->drush('php-eval', [$eval_content_count], $eval_options);
$this->assertEquals(10, $this->getOutput());

// Try to generate 1 content of type "page" or "article"
$this->drush('generate-content', [1], $this->getOptions(), NULL, NULL, static::EXIT_SUCCESS);
$this->assertContains('1 node created.', $this->getErrorOutput());
$this->drush('php-eval', [$eval_content_count], $eval_options);
$this->assertEquals(11, $this->getOutput());

// Try to generate 5 content of type "page" or "article", removing all
// previous contents.
$this->drush('generate-content', [5], $this->getOptions(TRUE), NULL, NULL, static::EXIT_SUCCESS);
$this->assertContains('Finished creating 5 nodes', $this->getErrorOutput());
$this->drush('php-eval', [$eval_content_count], $eval_options);
$this->assertEquals(5, $this->getOutput());

// Try to generate other 5 content with "crappy" type. Output should
// remains 5.
$generate_content_wrong_ct = $this->getOptions(TRUE) + ['types' => 'crappy'];
$this->drush('generate-content', [5], $generate_content_wrong_ct, NULL, NULL, static::EXIT_ERROR);
$this->assertContains('One or more content types have been entered that don', $this->getErrorOutput());
$this->drush('php-eval', [$eval_content_count], $eval_options);
$this->assertEquals(5, $this->getOutput());

// Try to generate other 5 content with empty types. Output should
// remains 5.
$generate_content_no_types = $this->getOptions(TRUE) + ['types' => ''];
$this->drush('generate-content', [5], $generate_content_no_types, NULL, NULL, static::EXIT_ERROR);
$this->assertContains('No content types available', $this->getErrorOutput());
$this->drush('php-eval', [$eval_content_count], $eval_options);
$this->assertEquals(5, $this->getOutput());

// Try to generate other 5 content without any types. Output should
// remains 5.
$generate_content_no_types = $this->getOptions(TRUE) + ['types' => NULL];
$this->drush('generate-content', [5], $generate_content_no_types, NULL, NULL, static::EXIT_ERROR);
$this->assertContains('Wrong syntax or no content type selected. The correct syntax uses', $this->getErrorOutput());
$this->drush('php-eval', [$eval_content_count], $eval_options);
$this->assertEquals(5, $this->getOutput());
}

/**
* Default drush options.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php

/**
* @file
* Contains \Drupal\devel_generate\Annotation\DevelGenerate.
*/

namespace Drupal\devel_generate\Annotation;

use Drupal\Component\Annotation\Plugin;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php

/**
* @file
* Contains \Drupal\devel_generate\DevelGenerateBase.
*/

namespace Drupal\devel_generate;

use Drupal\Component\Utility\Random;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<?php

/**
* @file
* Contains \Drupal\devel_generate\DevelGenerateInterface.
*/

namespace Drupal\devel_generate;

use Drupal\Component\Plugin\PluginInspectionInterface;
use Drupal\Core\Form\FormStateInterface;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?php
/**
* @file
* Definition of Drupal\devel_generate\DevelGenerateException.
*/

namespace Drupal\devel_generate;

use Drupal\Component\Plugin\Exception;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
<?php

/**
* @file
* Contains \Drupal\devel_generate\DevelGeneratePermissions.
*/

namespace Drupal\devel_generate;

use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\devel_generate\DevelGeneratePluginManager;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
<?php
/**
* @file
* Contains \Drupal\devel_generate\DevelGeneratePluginManager.
*/

namespace Drupal\devel_generate;

use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Language\LanguageManagerInterface;

/**
* Plugin type manager for DevelGenerate plugins.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php

/**
* @file
* Contains \Drupal\devel_generate\Form\DevelGenerateForm.
*/

namespace Drupal\devel_generate\Form;

use Drupal\Component\Plugin\PluginManagerInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php

/**
* @file
* Contains \Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate.
*/

namespace Drupal\devel_generate\Plugin\DevelGenerate;

use Drupal\comment\CommentManagerInterface;
Expand Down Expand Up @@ -384,6 +379,11 @@ public function validateDrushParams($args) {
$default_types = array_intersect(array('page', 'article'), $all_types);
$selected_types = _convert_csv_to_array(drush_get_option('types', $default_types));

// Validates the input format for content types option.
if (drush_get_option('types', $default_types) === TRUE) {
return drush_set_error('DEVEL_GENERATE_INVALID_INPUT', dt('Wrong syntax or no content type selected. The correct syntax uses "=", eg.: --types=page,article'));
}

if (empty($selected_types)) {
return drush_set_error('DEVEL_GENERATE_NO_CONTENT_TYPES', dt('No content types available'));
}
Expand All @@ -395,6 +395,11 @@ public function validateDrushParams($args) {
return drush_set_error('DEVEL_GENERATE_INVALID_INPUT', dt('Please provide content type (--types) in which you want to delete the content.'));
}

// Checks for any missing content types before generating nodes.
if (array_diff($node_types, $all_types)) {
return drush_set_error('DEVEL_GENERATE_INVALID_INPUT', dt('One or more content types have been entered that don\'t exist on this site'));
}

return $values;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php

/**
* @file
* Contains \Drupal\devel_generate\Plugin\DevelGenerate\MenuDevelGenerate.
*/

namespace Drupal\devel_generate\Plugin\DevelGenerate;

use Drupal\Component\Utility\Unicode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php

/**
* @file
* Contains \Drupal\devel_generate\Plugin\DevelGenerate\TermDevelGenerate.
*/

namespace Drupal\devel_generate\Plugin\DevelGenerate;

use Drupal\Core\Entity\EntityStorageInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php

/**
* @file
* Contains \Drupal\devel_generate\Plugin\DevelGenerate\UserDevelGenerate.
*/

namespace Drupal\devel_generate\Plugin\DevelGenerate;

use Drupal\Core\Datetime\DateFormatterInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php

/**
* @file
* Contains \Drupal\devel_generate\Plugin\DevelGenerate\VocabularyDevelGenerate.
*/

namespace Drupal\devel_generate\Plugin\DevelGenerate;

use Drupal\Component\Utility\Unicode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php

/**
* @file
*
* Definition of \Drupal\devel_generate\Routing\DevelGenerateRouteSubscriber.
*/
namespace Drupal\devel_generate\Routing;

use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php

/**
* @file
* Contains \Drupal\devel_generate\Tests\DevelGenerateTest.
*/

namespace Drupal\devel_generate\Tests;

use Drupal\comment\Tests\CommentTestTrait;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php

/**
* @file
* Contains \Drupal\devel_generate_example\Plugin\DevelGenerate\ExampleDevelGenerate.
*/

namespace Drupal\devel_generate_example\Plugin\DevelGenerate;

use Drupal\devel_generate\DevelGenerateBase;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php

/**
* @file
* Contains \Drupal\devel_node_access\Form\DnaForm.
*/

namespace Drupal\devel_node_access\Form;

use Drupal\Core\Form\FormBase;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,20 @@
<?php
/**
* @file
* Contains \Drupal\devel_node_access\Plugin\Block\DnaBlock.
*/

namespace Drupal\devel_node_access\Plugin\Block;

use Drupal\Component\Render\FormattableMarkup;
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Annotation\Translation;
use Drupal\Core\Block\Annotation\Block;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Form\FormBuilderInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Link;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Routing\RedirectDestinationTrait;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Session\AnonymousUserSession;
use Drupal\Core\Url;
use Drupal\node\Entity\Node;
use Drupal\user\Entity\Role;
use Symfony\Component\DependencyInjection\ContainerInterface;


/**
* Provides the "Devel Node Access" block.
*
Expand Down
7 changes: 3 additions & 4 deletions profiles/cr/modules/contrib/devel/drush/develDrushTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

if (class_exists('Unish\CommandUnishTestCase')) {

/*
* @file
* PHPUnit Tests for devel. This uses Drush's own test framework, based on PHPUnit.
* To run the tests, use run-tests-drush.sh from the devel directory.
/**
* PHPUnit Tests for devel. This uses Drush's own test framework, based on PHPUnit.
* To run the tests, use run-tests-drush.sh from the devel directory.
*/
class develCase extends CommandUnishTestCase {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php

/**
* @file
* Contains \Drupal\kint\Plugin\Devel\Dumper\Kint.
*/

namespace Drupal\kint\Plugin\Devel\Dumper;

use Drupal\devel\DevelDumperBase;
Expand Down
Loading

0 comments on commit cfeba9a

Please sign in to comment.