Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / drush / drush / tests / SecurityUpdatesTest.php
diff --git a/vendor/drush/drush/tests/SecurityUpdatesTest.php b/vendor/drush/drush/tests/SecurityUpdatesTest.php
new file mode 100644 (file)
index 0000000..9ef7db8
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+
+namespace Unish;
+
+/**
+ * Tests "pm:security" commands for D8+.
+ * @group commands
+ * @group slow
+ * @group pm
+ */
+class SecurityUpdatesTest extends CommandUnishTestCase
+{
+
+  /**
+   * Test that insecure packages are correctly identified.
+   */
+    public function testInsecurePackage()
+    {
+        $this->drush('pm:security', [], ['format' => 'json'], null, null, self::EXIT_ERROR);
+        $this->assertContains('One or more of your dependencies has an outstanding security update. Please apply update(s) immediately.', $this->getErrorOutput());
+        $this->assertContains('Try running: composer require drupal/alinks:^1.1 --update-with-dependencies', $this->getErrorOutput());
+        $security_advisories = $this->getOutputFromJSON();
+        $this->assertObjectHasAttribute('drupal/alinks', $security_advisories);
+        $this->assertEquals('drupal/alinks', $security_advisories->{"drupal/alinks"}->name);
+        $this->assertEquals('1.0.0', $security_advisories->{"drupal/alinks"}->version);
+        $this->assertEquals('1.1', $security_advisories->{"drupal/alinks"}->{"min-version"});
+    }
+}