summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoshe Weitzman2018-03-13 22:46:45 (GMT)
committerMoshe Weitzman2018-03-14 18:20:55 (GMT)
commit46ca997758a9f95b40749b40989d153daefc957e (patch)
tree6e698ba6113e63703005287cfc739e418a0ed24a
parent60a775d1e22575d18a70810cdefe881ddc81ffd7 (diff)
Add a Unish test
-rw-r--r--drush/develDrushTest.php38
-rwxr-xr-xrun-tests-drush.sh21
-rw-r--r--tests/src/Unish/DevelDrushTest.php31
-rw-r--r--tests/src/Unish/README.md6
4 files changed, 37 insertions, 59 deletions
diff --git a/drush/develDrushTest.php b/drush/develDrushTest.php
deleted file mode 100644
index 54a5cf9..0000000
--- a/drush/develDrushTest.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-namespace Unish;
-
-if (class_exists('Unish\CommandUnishTestCase')) {
-
- /**
- * 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 {
-
- public function testFnCommands() {
- // Specify '8' just in case user has not set UNISH_DRUPAL_MAJOR_VERSION env variable.
- $sites = $this->setUpDrupal(1, TRUE, '8');
-
- // Symlink this module into the Site Under test so it can be enabled.
- $target = dirname(__DIR__);
- \symlink($target, $this->webroot() . '/modules/devel');
- $options = array(
- 'root' => $this->webroot(),
- 'uri' => key($sites),
- );
- $this->drush('pm-enable', array('devel'), $options + array('skip' => NULL, 'yes' => NULL));
-
- $this->drush('fn-view', array('drush_main'), $options);
- $output = $this->getOutput();
- $this->assertContains('@return', $output, 'Output contain @return Doxygen.');
- $this->assertContains('function drush_main() {', $output, 'Output contains function drush_main() declaration');
-
- // $this->drush('fn-hook', array('cron'), $options);
- // $output = $this->getOutputAsList();
- // $expected = array('dblog', 'file', 'field', 'system', 'update');
- // $this->assertSame($expected, $output);
- }
- }
-
-}
diff --git a/run-tests-drush.sh b/run-tests-drush.sh
deleted file mode 100755
index 4dcd4fb..0000000
--- a/run-tests-drush.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env sh
-
-# This script will run phpunit-based test classes using Drush's
-# test framework. First, the Drush executable is located, and
-# then phpunit is invoked, pointing to Drush's phpunit.xml as
-# the configuration.
-#
-# Any parameters that may be passed to `phpunit` may also be used
-# with this script.
-
-DRUSH_PATH="`which drush`"
-DRUSH_DIRNAME="`dirname -- "$DRUSH_PATH"`"
-# The following line is needed is you use a `drush` that differs from `which drush`
-# export UNISH_DRUSH=$DRUSH_PATH
-
-if [ $# = 0 ] ; then
- phpunit --configuration="$DRUSH_DIRNAME/tests" drush
-else
- # Pass along any arguments.
- phpunit --configuration="$DRUSH_DIRNAME/tests" $@
-fi
diff --git a/tests/src/Unish/DevelDrushTest.php b/tests/src/Unish/DevelDrushTest.php
new file mode 100644
index 0000000..4298144
--- /dev/null
+++ b/tests/src/Unish/DevelDrushTest.php
@@ -0,0 +1,31 @@
+<?php
+
+namespace Drupal\Tests\devel\Unish;
+
+use Unish\CommandUnishTestCase;
+
+/**
+ * @group devel
+ * @group commands
+ */
+class DevelDrushTest extends CommandUnishTestCase {
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function setUp() {
+ $this->setUpDrupal(1, true);
+ $this->drush('pm:enable', ['devel']);
+ }
+
+ /**
+ * Test devel:services command.
+ */
+ public function testServices() {
+ $this->drush('devel:services');
+ $output = $this->getOutput();
+ $this->assertContains('account_switcher', $output);
+ }
+
+}
+
diff --git a/tests/src/Unish/README.md b/tests/src/Unish/README.md
new file mode 100644
index 0000000..debe184
--- /dev/null
+++ b/tests/src/Unish/README.md
@@ -0,0 +1,6 @@
+Running Unish Tests
+===================
+
+Follow instructions provided by [Drush test README.md](https://github.com/drush-ops/drush/blob/master/tests/README.md) in order to test Unish test cases provided by contrib modules.
+
+See: https://github.com/drush-ops/drush/blob/master/tests/README.md \ No newline at end of file