From 80bf30ca45d6de9697bf0ed699a2bd6e357cda2a Mon Sep 17 00:00:00 2001 From: addshore Date: Tue, 11 Mar 2014 16:53:03 +0100 Subject: [PATCH] Split up some long lines in tests Change-Id: I45be8ea1b9a9a974614354c0199e3107a5cdc23e --- tests/MathCoverageTest.php | 6 +++++- tests/MathDatabaseTest.php | 2 +- tests/MathInputCheckTest.php | 2 +- tests/MathInputCheckTexvcTest.php | 7 +++++-- tests/MathLaTeXMLTest.php | 22 ++++++++++++++++++---- tests/MathRendererTest.php | 13 +++++++++---- tests/MathSourceTest.php | 14 ++++++++++---- 7 files changed, 49 insertions(+), 17 deletions(-) diff --git a/tests/MathCoverageTest.php b/tests/MathCoverageTest.php index 61f027e..884ea0d 100644 --- a/tests/MathCoverageTest.php +++ b/tests/MathCoverageTest.php @@ -68,7 +68,11 @@ class MathCoverageTest extends MediaWikiTestCase { // TODO: Make rendering mode configurable // TODO: Provide test-ids // TODO: Link to the wikipage that contains the reference rendering - $this->assertEquals( $this->normalize( $output ), $this->normalize( MathRenderer::renderMath( $input , array(), MW_MATH_PNG ) ), "Failed to render $input" ); + $this->assertEquals( + $this->normalize( $output ), + $this->normalize( MathRenderer::renderMath( $input, array(), MW_MATH_PNG ) ), + "Failed to render $input" + ); } /** diff --git a/tests/MathDatabaseTest.php b/tests/MathDatabaseTest.php index 907eb1c..2b8453f 100644 --- a/tests/MathDatabaseTest.php +++ b/tests/MathDatabaseTest.php @@ -98,7 +98,7 @@ class MathDatabaseTest extends MediaWikiTestCase { $this->renderer->writeToDatabase(); $res = $this->db->select( "math", "*" ); $row = $res->fetchRow(); - $this->assertEquals( sizeof( $row ), 2 * self::NUM_BASIC_FIELDS ); + $this->assertEquals( count( $row ), 2 * self::NUM_BASIC_FIELDS ); } } diff --git a/tests/MathInputCheckTest.php b/tests/MathInputCheckTest.php index 3a76dc5..13d2699 100644 --- a/tests/MathInputCheckTest.php +++ b/tests/MathInputCheckTest.php @@ -9,7 +9,7 @@ class MathInputCheckTest extends MediaWikiTestCase */ public function testIsValid() { $InputCheck = $this->getMockBuilder( 'MathInputCheck' )->getMock(); - $this->assertEquals( $InputCheck->IsValid() , false ); + $this->assertEquals( $InputCheck->IsValid(), false ); } /** diff --git a/tests/MathInputCheckTexvcTest.php b/tests/MathInputCheckTexvcTest.php index b1c9654..4c3a582 100644 --- a/tests/MathInputCheckTexvcTest.php +++ b/tests/MathInputCheckTexvcTest.php @@ -76,7 +76,10 @@ class MathInputCheckTexvcTest extends MediaWikiTestCase { } $time = microtime( true ) - $tstart; - $this->assertTrue( $time < $maxAvgTime * $numberOfRuns, 'function is_executable consumes too much time' ); + $this->assertTrue( + $time < $maxAvgTime * $numberOfRuns, + 'function is_executable consumes too much time' + ); } /** @@ -118,7 +121,7 @@ class MathInputCheckTexvcTest extends MediaWikiTestCase { $this->assertNull( $this->BadObject->getValidTex() ); // Be aware of the additional brackets and spaces inserted here - $this->assertEquals( $this->GoodObject->getValidTex() , "\\sin \\left({\\frac 12}x\\right)" ); + $this->assertEquals( $this->GoodObject->getValidTex(), "\\sin \\left({\\frac 12}x\\right)" ); } /** diff --git a/tests/MathLaTeXMLTest.php b/tests/MathLaTeXMLTest.php index e6cb5b6..e2d6f8e 100644 --- a/tests/MathLaTeXMLTest.php +++ b/tests/MathLaTeXMLTest.php @@ -97,8 +97,14 @@ class MathLaTeXMLTest extends MediaWikiTestCase { public function testisValidXML() { $validSample = 'content'; $invalidSample = ''; - $this->assertTrue( MathLaTeXML::isValidMathML( $validSample ), 'test if math expression is valid mathml sample' ); - $this->assertFalse( MathLaTeXML::isValidMathML( $invalidSample ), 'test if math expression is invalid mathml sample' ); + $this->assertTrue( + MathLaTeXML::isValidMathML( $validSample ), + 'test if math expression is valid mathml sample' + ); + $this->assertFalse( + MathLaTeXML::isValidMathML( $invalidSample ), + 'test if math expression is invalid mathml sample' + ); } /** @@ -117,8 +123,16 @@ class MathLaTeXMLTest extends MediaWikiTestCase { 'v3A', 'v3b' ) ); $expected = 'k1=v1&k2%26%3D=v2+%2B+%26+%2A%C3%BC%C3%B6&k3=v3A&k3=v3b'; - $this->assertEquals( $expected, $renderer->serializeSettings( $sampleSettings ), 'test serialization of array settings' ); - $this->assertEquals( $expected, $renderer->serializeSettings( $expected ), 'test serialization of a string setting' ); + $this->assertEquals( + $expected, + $renderer->serializeSettings( $sampleSettings ), + 'test serialization of array settings' + ); + $this->assertEquals( + $expected, + $renderer->serializeSettings( $expected ), + 'test serialization of a string setting' + ); } /** * Checks the basic functionallity diff --git a/tests/MathRendererTest.php b/tests/MathRendererTest.php index c8ac3e3..9ee43f1 100644 --- a/tests/MathRendererTest.php +++ b/tests/MathRendererTest.php @@ -57,11 +57,16 @@ class MathRendererTest extends MediaWikiTestCase { ->setMethods( array( 'render' ) ) ->disableOriginalConstructor() ->getMock(); - $this->assertEquals( $renderer->isChanged(), false - , "test if changed is initially false" ); + $this->assertEquals( + $renderer->isChanged(), + false, + "test if changed is initially false" + ); $renderer->setHash( '0000' ); - $this->assertEquals( $renderer->isChanged(), true - , "assumes that changing a hash sets changed to true" ); + $this->assertEquals( + $renderer->isChanged(), + true, + "assumes that changing a hash sets changed to true" ); } public function testSetPurge() { diff --git a/tests/MathSourceTest.php b/tests/MathSourceTest.php index dfc4ddd..dd48f63 100644 --- a/tests/MathSourceTest.php +++ b/tests/MathSourceTest.php @@ -11,8 +11,11 @@ class MathSourceTest extends MediaWikiTestCase { */ public function testBasics() { $real = MathRenderer::renderMath( "a+b", array(), MW_MATH_SOURCE ); - $this->assertEquals( '$ a+b $', $real - , "Rendering of a+b in plain Text mode" ); + $this->assertEquals( + '$ a+b $', + $real, + "Rendering of a+b in plain Text mode" + ); } /** @@ -20,8 +23,11 @@ class MathSourceTest extends MediaWikiTestCase { */ public function testNewLines() { $real = MathRenderer::renderMath( "a\n b", array(), MW_MATH_SOURCE ); - $this->assertSame( '$ a b $', $real - , "converting newlines to spaces" ); + $this->assertSame( + '$ a b $', + $real, + "converting newlines to spaces" + ); } } \ No newline at end of file