[CHANGED] Replaced "assertEquals" with "assertCount" where it was necessary.
This commit is contained in:
parent
d35db836dc
commit
0ea2193906
@ -43,12 +43,11 @@ class AutoloaderTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testAutoload()
|
||||
{
|
||||
$declared = get_declared_classes();
|
||||
$declaredCount = count($declared);
|
||||
$declaredCount = count(get_declared_classes());
|
||||
Autoloader::autoload('Foo');
|
||||
$this->assertEquals(
|
||||
$this->assertCount(
|
||||
$declaredCount,
|
||||
count(get_declared_classes()),
|
||||
get_declared_classes(),
|
||||
'PhpOffice\\PhpWord\\Autoloader::autoload() is trying to load ' .
|
||||
'classes outside of the PhpOffice\\PhpWord namespace'
|
||||
);
|
||||
|
||||
@ -28,8 +28,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase
|
||||
$object->addItem(new Footnote()); // addItem #1
|
||||
|
||||
$this->assertEquals(2, $object->addItem(new Footnote())); // addItem #2. Should returns new item index
|
||||
$this->assertEquals(2, $object->countItems()); // There are two items now
|
||||
$this->assertEquals(2, count($object->getItems())); // getItems returns array
|
||||
$this->assertCount(2, $object->getItems()); // getItems returns array
|
||||
$this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Footnote', $object->getItem(1)); // getItem returns object
|
||||
$this->assertNull($object->getItem(3)); // getItem returns null when invalid index is referenced
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ class MediaTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testCountSectionMediaElementsWithNull()
|
||||
{
|
||||
$this->assertEquals(Media::countElements('section'), 0);
|
||||
$this->assertEquals(0, Media::countElements('section'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -57,7 +57,7 @@ class MediaTest extends \PHPUnit_Framework_TestCase
|
||||
Media::addElement('section', 'object', $object);
|
||||
Media::addElement('section', 'object', $object);
|
||||
|
||||
$this->assertEquals(3, Media::countElements('section'));
|
||||
$this->assertCount(3, Media::getElements('section'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,8 +69,7 @@ class MediaTest extends \PHPUnit_Framework_TestCase
|
||||
$actual = Media::addElement('section', 'link', 'http://test.com');
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
$this->assertEquals(1, Media::countElements('section', 'link'));
|
||||
$this->assertEquals(1, count(Media::getElements('section', 'link')));
|
||||
$this->assertCount(1, Media::getElements('section', 'link'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,8 +83,7 @@ class MediaTest extends \PHPUnit_Framework_TestCase
|
||||
Media::addElement('header1', 'image', $local, new Image($local));
|
||||
Media::addElement('header1', 'image', $remote, new Image($remote));
|
||||
|
||||
$this->assertEquals(2, Media::countElements('header1'));
|
||||
$this->assertEquals(2, count(Media::getElements('header1')));
|
||||
$this->assertCount(2, Media::getElements('header1'));
|
||||
$this->assertEmpty(Media::getElements('header2'));
|
||||
}
|
||||
|
||||
@ -100,10 +98,10 @@ class MediaTest extends \PHPUnit_Framework_TestCase
|
||||
Media::addElement('footer1', 'image', $local, new Image($local));
|
||||
Media::addElement('footer1', 'image', $remote, new Image($remote));
|
||||
|
||||
$this->assertEquals(2, Media::countElements('footer1'));
|
||||
$this->assertCount(2, Media::getElements('footer1'));
|
||||
|
||||
Media::resetElements();
|
||||
$this->assertEquals(0, Media::countElements('footer1'));
|
||||
$this->assertCount(0, Media::getElements('footer1'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -47,7 +47,7 @@ class PhpWordTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$phpWord = new PhpWord();
|
||||
$phpWord->addSection();
|
||||
$this->assertEquals(1, count($phpWord->getSections()));
|
||||
$this->assertCount(1, $phpWord->getSections());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -34,7 +34,7 @@ class HtmlTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
// Default
|
||||
$section = new Section(1);
|
||||
$this->assertEquals(0, $section->countElements());
|
||||
$this->assertCount(0, $section->getElements());
|
||||
|
||||
// Heading
|
||||
$styles = array('strong', 'em', 'sup', 'sub');
|
||||
@ -52,7 +52,7 @@ class HtmlTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
// Add HTML
|
||||
Html::addHtml($section, $content);
|
||||
$this->assertEquals(7, $section->countElements());
|
||||
$this->assertCount(7, $section->getElements());
|
||||
|
||||
// Other parts
|
||||
$section = new Section(1);
|
||||
|
||||
@ -119,7 +119,7 @@ class ParagraphTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$object = new Paragraph();
|
||||
$object->setTabs(array(new Tab('left', 1550), new Tab('right', 5300)));
|
||||
$this->assertEquals(2, count($object->getTabs()));
|
||||
$this->assertCount(2, $object->getTabs());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user