Add tests for IE workarounds to ActionTest
authorThiemo Mättig <thiemo.maettig@wikimedia.de>
Thu, 17 Jul 2014 08:14:29 +0000 (10:14 +0200)
committerThiemo Mättig <thiemo.maettig@wikimedia.de>
Tue, 22 Jul 2014 11:55:44 +0000 (13:55 +0200)
Change-Id: Iafaa3266e57f22f108c0253053103681bd88bd10

tests/phpunit/includes/actions/ActionTest.php

index 6175ee6..eb370d9 100644 (file)
@@ -18,6 +18,8 @@ class ActionTest extends MediaWikiTestCase {
                        'null' => null,
                        'disabled' => false,
                        'view' => true,
+                       'edit' => true,
+                       'revisiondelete' => true,
                        'dummy' => true,
                        'string' => 'NamedDummyAction',
                        'declared' => 'NonExistingClassName',
@@ -89,6 +91,31 @@ class ActionTest extends MediaWikiTestCase {
                $this->assertEquals( $expected ?: 'nosuchaction', $actionName );
        }
 
+       public function testGetActionName_editredlinkWorkaround() {
+               // See https://bugzilla.wikimedia.org/show_bug.cgi?id=20966
+               $context = $this->getContext( 'editredlink' );
+               $actionName = Action::getActionName( $context );
+
+               $this->assertEquals( 'edit', $actionName );
+       }
+
+       public function testGetActionName_historysubmitWorkaround() {
+               // See https://bugzilla.wikimedia.org/show_bug.cgi?id=20966
+               $context = $this->getContext( 'historysubmit' );
+               $actionName = Action::getActionName( $context );
+
+               $this->assertEquals( 'view', $actionName );
+       }
+
+       public function testGetActionName_revisiondeleteWorkaround() {
+               // See https://bugzilla.wikimedia.org/show_bug.cgi?id=20966
+               $context = $this->getContext( 'historysubmit' );
+               $context->getRequest()->setVal( 'revisiondelete', true );
+               $actionName = Action::getActionName( $context );
+
+               $this->assertEquals( 'revisiondelete', $actionName );
+       }
+
        /**
         * @dataProvider actionProvider
         * @param string $requestedAction