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: 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"
);
}
/**

View File

@ -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 );
}
}

View File

@ -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 );
}
/**

View File

@ -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)" );
}
/**

View File

@ -97,8 +97,14 @@ class MathLaTeXMLTest extends MediaWikiTestCase {
public function testisValidXML() {
$validSample = '<math>content</math>';
$invalidSample = '<notmath />';
$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

View File

@ -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() {

View File

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