diff --git a/tests/PhpWord/Tests/AutoloaderTest.php b/tests/PhpWord/Tests/AutoloaderTest.php index 92423fc6..dace5bdb 100644 --- a/tests/PhpWord/Tests/AutoloaderTest.php +++ b/tests/PhpWord/Tests/AutoloaderTest.php @@ -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' ); diff --git a/tests/PhpWord/Tests/Collection/CollectionTest.php b/tests/PhpWord/Tests/Collection/CollectionTest.php index e3d08da2..833b3e80 100644 --- a/tests/PhpWord/Tests/Collection/CollectionTest.php +++ b/tests/PhpWord/Tests/Collection/CollectionTest.php @@ -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 diff --git a/tests/PhpWord/Tests/MediaTest.php b/tests/PhpWord/Tests/MediaTest.php index 1b89b7c1..0196a7e1 100644 --- a/tests/PhpWord/Tests/MediaTest.php +++ b/tests/PhpWord/Tests/MediaTest.php @@ -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')); } /** diff --git a/tests/PhpWord/Tests/PhpWordTest.php b/tests/PhpWord/Tests/PhpWordTest.php index 6fd4b291..75b2d288 100644 --- a/tests/PhpWord/Tests/PhpWordTest.php +++ b/tests/PhpWord/Tests/PhpWordTest.php @@ -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()); } /** diff --git a/tests/PhpWord/Tests/Shared/HtmlTest.php b/tests/PhpWord/Tests/Shared/HtmlTest.php index e7b3533e..c4c0fc9d 100644 --- a/tests/PhpWord/Tests/Shared/HtmlTest.php +++ b/tests/PhpWord/Tests/Shared/HtmlTest.php @@ -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); diff --git a/tests/PhpWord/Tests/Style/ParagraphTest.php b/tests/PhpWord/Tests/Style/ParagraphTest.php index 12aa51ce..73540b0c 100644 --- a/tests/PhpWord/Tests/Style/ParagraphTest.php +++ b/tests/PhpWord/Tests/Style/ParagraphTest.php @@ -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()); } /**