Ejegg has submitted this change and it was merged. Change subject: Merge branch 'master' into deployment ......................................................................
Merge branch 'master' into deployment 1082e84 Localisation updates from https://translatewiki.net. fe8d25f Localisation updates from https://translatewiki.net. 006ba9f Don't close Amazon order reference in DI 3155e27 Make default appeal configurable Change-Id: Ibee4a90626392fda5d9bd091bddebf465b3f8177 --- D tests/MustacheFormTest.php 1 file changed, 0 insertions(+), 178 deletions(-) Approvals: Ejegg: Verified; Looks good to me, approved diff --git a/tests/MustacheFormTest.php b/tests/MustacheFormTest.php deleted file mode 100644 index f76ff31..0000000 --- a/tests/MustacheFormTest.php +++ /dev/null @@ -1,178 +0,0 @@ -<<<<<<< HEAD (7bad86 Merge branch 'master' into deployment) -======= -<?php -/** - * Wikimedia Foundation - * - * LICENSE - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -/** - * @group Fundraising - * @group DonationInterface - * @group GatewayPage - */ -class MustacheFormTest extends DonationInterfaceTestCase { - protected $form; - protected $adapter; - protected $outputPage; - - public function setUp() { - $this->adapter = new TestingGenericAdapter(); - $this->adapter->addRequestData( array( - 'amount' => '12', - 'currency_code' => 'EUR', - ) ); - - $this->outputPage = $this->getMockBuilder( 'OutputPage' ) - ->disableOriginalConstructor() - ->setMethods( array( 'parse' ) ) - ->getMock(); - - RequestContext::getMain()->setOutput( $this->outputPage ); - - $req = new TestingRequest(); - RequestContext::getMain()->setRequest( $req ); - $this->setMwGlobals( array( - 'wgRequest' => $req, - 'wgTitle' => Title::newFromText( 'nonsense is apparently fine' ) - ) ); - - parent::setUp(); - } - - public function tearDown() { - $this->adapter->clearGlobalsCache(); - parent::tearDown(); - } - - public function formCases() { - return array( - array( 'empty', '/^$/' ), - array( 'foo', '/FOO/' ), - array( 'currency', '/EUR/' ), - ); - } - - /** - * Render a few simple Mustache files and match the output - * - * @dataProvider formCases - */ - public function testRendering( $name, $regexp ) { - $this->setMwGlobals( array( - 'wgDonationInterfaceTemplate' => __DIR__ . "/data/mustache/{$name}.mustache", - ) ); - $this->form = new Gateway_Form_Mustache( $this->adapter ); - $html = $this->form->getForm(); - - $this->assertRegExp( $regexp, $html ); - } - - /** - * @expectedException Exception - * @expectedExceptionMessage Template file unavailable - */ - public function testNoTemplateFile() { - $this->setMwGlobals( array( - 'wgDonationInterfaceTemplate' => __DIR__ . "/data/mustache/DONOTCREATE.mustache", - ) ); - $this->form = new Gateway_Form_Mustache( $this->adapter ); - // Suppress the error cos: we know. - $html = @$this->form->getForm(); - - $this->fail( 'I\'m not dead yet!' ); - } - - /** - * Transclude an appeal - * @requires PHPUnit 4.0 - */ - public function testAppealRendering() { - $this->setMwGlobals( array( - 'wgDonationInterfaceTemplate' => __DIR__ . "/data/mustache/appeal.mustache", - 'wgDonationInterfaceAppealWikiTemplate' => 'JimmySezPleeeeeze/$appeal/$language', - ) ); - - $this->outputPage->method( 'parse' ) - ->willReturn( '<p>This is the template text</p>' ); - $this->outputPage->expects( $this->once() ) - ->method( 'parse' ) - ->with( $this->equalTo( '{{JimmySezPleeeeeze/JimmyQuote/en}}' ) ); - - $this->form = new Gateway_Form_Mustache( $this->adapter ); - $html = $this->form->getForm(); - - $this->assertEquals( "<p>This is the template text</p>\n", $html ); - } - - /** - * Override the transcluded appeal on the query string - * @requires PHPUnit 4.0 - */ - public function testOverrideAppeal() { - $this->setMwGlobals( array( - 'wgDonationInterfaceTemplate' => __DIR__ . "/data/mustache/appeal.mustache", - 'wgDonationInterfaceAppealWikiTemplate' => 'JimmySezPleeeeeze/$appeal/$language', - ) ); - - RequestContext::getMain()->getRequest()->setVal( 'appeal', 'differentAppeal' ); - - $this->outputPage->expects( $this->once() ) - ->method( 'parse' ) - ->with( $this->equalTo( '{{JimmySezPleeeeeze/differentAppeal/en}}' ) ); - - $this->form = new Gateway_Form_Mustache( $this->adapter ); - $html = $this->form->getForm(); - } - - /** - * Same as above, but don't let any shady characters in - * @requires PHPUnit 4.0 - */ - public function testSanitizeOverrideAppeal() { - $this->setMwGlobals( array( - 'wgDonationInterfaceTemplate' => __DIR__ . "/data/mustache/appeal.mustache", - 'wgDonationInterfaceAppealWikiTemplate' => 'JimmySezPleeeeeze/$appeal/$language', - ) ); - - RequestContext::getMain()->getRequest()->setVal( 'appeal', '}}<script>alert("all your base are belong to us");</script>{{' ); - - $this->outputPage->expects( $this->once() ) - ->method( 'parse' ) - ->with( $this->equalTo( '{{JimmySezPleeeeeze/scriptalertallyourbasearebelongtousscript/en}}' ) ); - - $this->form = new Gateway_Form_Mustache( $this->adapter ); - $html = $this->form->getForm(); - } - - /** - * Test rendering l10n with parameters - * @dataProvider belgiumLanguageProvider - */ - public function testL10nParams( $language ) { - $this->setMwGlobals( array( - 'wgDonationInterfaceTemplate' => __DIR__ . "/data/mustache/l10n.mustache", - ) ); - $this->setLanguage( $language ); - $this->adapter->addRequestData( array( 'language' => $language ) ); - $this->form = new Gateway_Form_Mustache( $this->adapter ); - $html = $this->form->getForm(); - $expected = htmlspecialchars( - wfMessage( 'donate_interface-bigamount-error', '12.00', 'EUR', 'donor-supp...@worthyfoundation.org' )->text() - ); - $this->assertEquals( $expected, trim( $html ) ); - } -} ->>>>>>> BRANCH (3155e2 Make default appeal configurable) -- To view, visit https://gerrit.wikimedia.org/r/242377 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ibee4a90626392fda5d9bd091bddebf465b3f8177 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/DonationInterface Gerrit-Branch: deployment Gerrit-Owner: Ejegg <eeggles...@wikimedia.org> Gerrit-Reviewer: Ejegg <eeggles...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits