Skip to content

Commit

Permalink
Various test case corrections and PHPUnit update
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveChild committed Aug 21, 2018
1 parent ec1894c commit 286a7df
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion tests/TextStatisticsCMULexTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class TextStatisticsTestCMULex extends PHPUnit_Framework_TestCase
class TextStatisticsTestCMULex extends \PHPUnit\Framework\TestCase
{

/*
Expand Down
4 changes: 2 additions & 2 deletions tests/TextStatisticsKiplingIfTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class TextStatisticsKiplingIf extends PHPUnit_Framework_TestCase
class TextStatisticsKiplingIf extends \PHPUnit\Framework\TestCase
{

/*
Expand Down Expand Up @@ -456,7 +456,7 @@ public function testColemanLiauIndex()
-------------------- */
public function testSMOGIndex()
{
$this->assertEquals(7.2, $this->TextStatistics->smog_index($this->strText));
$this->assertEquals(10.3, $this->TextStatistics->smog_index($this->strText));
}

/* Test Automated Readability Index
Expand Down
26 changes: 13 additions & 13 deletions tests/TextStatisticsMaths.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class TextStatisticsMaths extends PHPUnit_Framework_TestCase
class TextStatisticsMaths extends \PHPUnit\Framework\TestCase
{

/*
Expand Down Expand Up @@ -81,12 +81,12 @@ public function testCalc()
$this->assertSame(3.0, DaveChild\TextStatistics\Maths::bcCalc(10, 'mod', 7, true, 1));
$this->assertSame(3.0, DaveChild\TextStatistics\Maths::bcCalc(10, 'modulus', 7, true, 1));
// Modulus can only be an integer and is rounded before calculation
$this->assertSame(0.0, DaveChild\TextStatistics\Maths::bcCalc(10, '%', 5.55, true, 1));
$this->assertSame(0.0, DaveChild\TextStatistics\Maths::bcCalc(10, 'mod', 5.55, true, 1));
$this->assertSame(0.0, DaveChild\TextStatistics\Maths::bcCalc(10, 'modulus', 5.55, true, 1));
$this->assertSame(3.0, DaveChild\TextStatistics\Maths::bcCalc(10, '%', 7.55, true, 1));
$this->assertSame(3.0, DaveChild\TextStatistics\Maths::bcCalc(10, 'mod', 7.55, true, 1));
$this->assertSame(3.0, DaveChild\TextStatistics\Maths::bcCalc(10, 'modulus', 7.55, true, 1));
$this->assertSame(4.0, DaveChild\TextStatistics\Maths::bcCalc(10, '%', 5.55, true, 1));
$this->assertSame(4.0, DaveChild\TextStatistics\Maths::bcCalc(10, 'mod', 5.55, true, 1));
$this->assertSame(4.0, DaveChild\TextStatistics\Maths::bcCalc(10, 'modulus', 5.55, true, 1));
$this->assertSame(2.0, DaveChild\TextStatistics\Maths::bcCalc(10, '%', 7.55, true, 1));
$this->assertSame(2.0, DaveChild\TextStatistics\Maths::bcCalc(10, 'mod', 7.55, true, 1));
$this->assertSame(2.0, DaveChild\TextStatistics\Maths::bcCalc(10, 'modulus', 7.55, true, 1));

$this->assertSame(1, DaveChild\TextStatistics\Maths::bcCalc(10, '=', 5, true, 1));
$this->assertSame(1, DaveChild\TextStatistics\Maths::bcCalc(10, 'comp', 5, true, 1));
Expand Down Expand Up @@ -139,12 +139,12 @@ public function testCalc()
$this->assertSame(3, DaveChild\TextStatistics\Maths::bcCalc(10, 'mod', 7));
$this->assertSame(3, DaveChild\TextStatistics\Maths::bcCalc(10, 'modulus', 7));
// Modulus can only be an integer and is rounded before calculation
$this->assertSame(0, DaveChild\TextStatistics\Maths::bcCalc(10, '%', 5.55));
$this->assertSame(0, DaveChild\TextStatistics\Maths::bcCalc(10, 'mod', 5.55));
$this->assertSame(0, DaveChild\TextStatistics\Maths::bcCalc(10, 'modulus', 5.55));
$this->assertSame(3, DaveChild\TextStatistics\Maths::bcCalc(10, '%', 7.55));
$this->assertSame(3, DaveChild\TextStatistics\Maths::bcCalc(10, 'mod', 7.55));
$this->assertSame(3, DaveChild\TextStatistics\Maths::bcCalc(10, 'modulus', 7.55));
$this->assertSame(4, DaveChild\TextStatistics\Maths::bcCalc(10, '%', 5.55));
$this->assertSame(4, DaveChild\TextStatistics\Maths::bcCalc(10, 'mod', 5.55));
$this->assertSame(4, DaveChild\TextStatistics\Maths::bcCalc(10, 'modulus', 5.55));
$this->assertSame(2, DaveChild\TextStatistics\Maths::bcCalc(10, '%', 7.55));
$this->assertSame(2, DaveChild\TextStatistics\Maths::bcCalc(10, 'mod', 7.55));
$this->assertSame(2, DaveChild\TextStatistics\Maths::bcCalc(10, 'modulus', 7.55));

$this->assertSame(1, DaveChild\TextStatistics\Maths::bcCalc(10, '=', 5));
$this->assertSame(1, DaveChild\TextStatistics\Maths::bcCalc(10, 'comp', 5));
Expand Down
6 changes: 3 additions & 3 deletions tests/TextStatisticsMelvilleMobyDickTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class TextStatisticsMelvilleMobyDick extends PHPUnit_Framework_TestCase
class TextStatisticsMelvilleMobyDick extends \PHPUnit\Framework\TestCase
{

/*
Expand Down Expand Up @@ -325,7 +325,7 @@ public function testColemanLiauIndex()
-------------------- */
public function testSMOGIndex()
{
$this->assertEquals(9.9, $this->TextStatistics->smog_index($this->strText));
$this->assertEquals(13.0, $this->TextStatistics->smog_index($this->strText));
}

/* Test Automated Readability Index
Expand All @@ -334,4 +334,4 @@ public function testAutomatedReadabilityIndex()
{
$this->assertEquals(11.8, $this->TextStatistics->automated_readability_index($this->strText));
}
}
}
2 changes: 1 addition & 1 deletion tests/TextStatisticsPluralise.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class TextStatisticsPluralise extends PHPUnit_Framework_TestCase
class TextStatisticsPluralise extends \PHPUnit\Framework\TestCase
{

/*
Expand Down
14 changes: 7 additions & 7 deletions tests/TextStatisticsTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class TextStatisticsTest extends PHPUnit_Framework_TestCase
class TextStatisticsTest extends \PHPUnit\Framework\TestCase
{

/*
Expand Down Expand Up @@ -300,12 +300,12 @@ public function testColemanLiauIndex()

public function testSMOGIndex()
{
$this->assertEquals(1.8, $this->TextStatistics->smog_index('This. Is. A. Nice. Set. Of. Small. Words. Of. One. Part. Each.')); // Should be 1.8 for any text with no words of 3+ syllables
$this->assertEquals(1.8, $this->TextStatistics->smog_index('The quick brown fox jumps over the lazy dog.'));
$this->assertEquals(1.8, $this->TextStatistics->smog_index('The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.'));
$this->assertEquals(1.8, $this->TextStatistics->smog_index("The quick brown fox jumps over the lazy dog. \n\n The quick brown fox jumps over the lazy dog."));
$this->assertEquals(1.8, $this->TextStatistics->smog_index('The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog'));
$this->assertEquals(10.1, $this->TextStatistics->smog_index('Now it is time for a more complicated sentence, including several longer words.'));
$this->assertEquals(3.3, $this->TextStatistics->smog_index('This. Is. A. Nice. Set. Of. Small. Words. Of. One. Part. Each.')); // Should be 1.8 for any text with no words of 3+ syllables
$this->assertEquals(3.3, $this->TextStatistics->smog_index('The quick brown fox jumps over the lazy dog.'));
$this->assertEquals(3.3, $this->TextStatistics->smog_index('The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.'));
$this->assertEquals(3.3, $this->TextStatistics->smog_index("The quick brown fox jumps over the lazy dog. \n\n The quick brown fox jumps over the lazy dog."));
$this->assertEquals(3.3, $this->TextStatistics->smog_index('The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog'));
$this->assertEquals(13.2, $this->TextStatistics->smog_index('Now it is time for a more complicated sentence, including several longer words.'));
}

public function testAutomatedReadabilityIndex()
Expand Down

0 comments on commit 286a7df

Please sign in to comment.