Split up some long lines in tests

Change-Id: I45be8ea1b9a9a974614354c0199e3107a5cdc23e
This commit is contained in:
addshore 2014-03-11 16:53:03 +01:00 committed by Physikerwelt
parent 6db9b0e6fe
commit 80bf30ca45
7 changed files with 49 additions and 17 deletions

View File

@ -68,7 +68,11 @@ class MathCoverageTest extends MediaWikiTestCase {
// TODO: Make rendering mode configurable // TODO: Make rendering mode configurable
// TODO: Provide test-ids // TODO: Provide test-ids
// TODO: Link to the wikipage that contains the reference rendering // 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"
);
} }
/** /**

View File

@ -98,7 +98,7 @@ class MathDatabaseTest extends MediaWikiTestCase {
$this->renderer->writeToDatabase(); $this->renderer->writeToDatabase();
$res = $this->db->select( "math", "*" ); $res = $this->db->select( "math", "*" );
$row = $res->fetchRow(); $row = $res->fetchRow();
$this->assertEquals( sizeof( $row ), 2 * self::NUM_BASIC_FIELDS ); $this->assertEquals( count( $row ), 2 * self::NUM_BASIC_FIELDS );
} }
} }

View File

@ -9,7 +9,7 @@ class MathInputCheckTest extends MediaWikiTestCase
*/ */
public function testIsValid() { public function testIsValid() {
$InputCheck = $this->getMockBuilder( 'MathInputCheck' )->getMock(); $InputCheck = $this->getMockBuilder( 'MathInputCheck' )->getMock();
$this->assertEquals( $InputCheck->IsValid() , false ); $this->assertEquals( $InputCheck->IsValid(), false );
} }
/** /**

View File

@ -76,7 +76,10 @@ class MathInputCheckTexvcTest extends MediaWikiTestCase {
} }
$time = microtime( true ) - $tstart; $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() ); $this->assertNull( $this->BadObject->getValidTex() );
// Be aware of the additional brackets and spaces inserted here // 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)" );
} }
/** /**

View File

@ -97,8 +97,14 @@ class MathLaTeXMLTest extends MediaWikiTestCase {
public function testisValidXML() { public function testisValidXML() {
$validSample = '<math>content</math>'; $validSample = '<math>content</math>';
$invalidSample = '<notmath />'; $invalidSample = '<notmath />';
$this->assertTrue( MathLaTeXML::isValidMathML( $validSample ), 'test if math expression is valid mathml sample' ); $this->assertTrue(
$this->assertFalse( MathLaTeXML::isValidMathML( $invalidSample ), 'test if math expression is invalid mathml sample' ); 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' 'v3A', 'v3b'
) ); ) );
$expected = 'k1=v1&k2%26%3D=v2+%2B+%26+%2A%C3%BC%C3%B6&k3=v3A&k3=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(
$this->assertEquals( $expected, $renderer->serializeSettings( $expected ), 'test serialization of a string setting' ); $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 * Checks the basic functionallity

View File

@ -57,11 +57,16 @@ class MathRendererTest extends MediaWikiTestCase {
->setMethods( array( 'render' ) ) ->setMethods( array( 'render' ) )
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->assertEquals( $renderer->isChanged(), false $this->assertEquals(
, "test if changed is initially false" ); $renderer->isChanged(),
false,
"test if changed is initially false"
);
$renderer->setHash( '0000' ); $renderer->setHash( '0000' );
$this->assertEquals( $renderer->isChanged(), true $this->assertEquals(
, "assumes that changing a hash sets changed to true" ); $renderer->isChanged(),
true,
"assumes that changing a hash sets changed to true" );
} }
public function testSetPurge() { public function testSetPurge() {

View File

@ -11,8 +11,11 @@ class MathSourceTest extends MediaWikiTestCase {
*/ */
public function testBasics() { public function testBasics() {
$real = MathRenderer::renderMath( "a+b", array(), MW_MATH_SOURCE ); $real = MathRenderer::renderMath( "a+b", array(), MW_MATH_SOURCE );
$this->assertEquals( '<span class="tex" dir="ltr">$ a+b $</span>', $real $this->assertEquals(
, "Rendering of a+b in plain Text mode" ); '<span class="tex" dir="ltr">$ a+b $</span>',
$real,
"Rendering of a+b in plain Text mode"
);
} }
/** /**
@ -20,8 +23,11 @@ class MathSourceTest extends MediaWikiTestCase {
*/ */
public function testNewLines() { public function testNewLines() {
$real = MathRenderer::renderMath( "a\n b", array(), MW_MATH_SOURCE ); $real = MathRenderer::renderMath( "a\n b", array(), MW_MATH_SOURCE );
$this->assertSame( '<span class="tex" dir="ltr">$ a b $</span>', $real $this->assertSame(
, "converting newlines to spaces" ); '<span class="tex" dir="ltr">$ a b $</span>',
$real,
"converting newlines to spaces"
);
} }
} }