Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use PHPUnit\Framework\TestCase instead of PHPUnit_Framework_TestCase #417

Merged
merged 1 commit into from
Dec 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Branch Master : [![Build Status](https://travis-ci.org/PHPOffice/PHPPresentation.svg?branch=master)](https://travis-ci.org/PHPOffice/PHPPresentation) [![Documentation Status](https://readthedocs.org/projects/phppresentation/badge/?version=master)](http://phppresentation.readthedocs.io/en/latest/?badge=master)
Branch Develop : [![Build Status](https://travis-ci.org/PHPOffice/PHPPresentation.svg?branch=develop)](https://travis-ci.org/PHPOffice/PHPPresentation) [![Documentation Status](https://readthedocs.org/projects/phppresentation/badge/?version=develop)](http://phppresentation.readthedocs.io/en/latest/?badge=develop)

PHPPresentation is a library written in pure PHP that provides a set of classes to write to different presentation file formats, i.e. Microsoft [Office Open XML](http://en.wikipedia.org/wiki/Office_Open_XML) (OOXML or OpenXML) or OASIS [Open Document Format for Office Applications](http://en.wikipedia.org/wiki/OpenDocument) (OpenDocument or ODF).
PHPPresentation is a library written in pure PHP that provides a set of classes to write to different presentation file formats, i.e. Microsoft [Office Open XML](http://en.wikipedia.org/wiki/Office_Open_XML) (OOXML or OpenXML) or OASIS [Open Document Format for Office Applications](http://en.wikipedia.org/wiki/OpenDocument) (OpenDocument or ODF).

PHPPresentation is an open source project licensed under the terms of [LGPL version 3](https://github.com/PHPOffice/PHPPresentation/blob/develop/COPYING.LESSER). PHPPresentation is aimed to be a high quality software product by incorporating [continuous integration](https://travis-ci.org/PHPOffice/PHPPresentation) and [unit testing](http://phpoffice.github.io/PHPPresentation/coverage/develop/). You can learn more about PHPPresentation by reading the [Developers' Documentation](http://phppresentation.readthedocs.org/) and the [API Documentation](http://phpoffice.github.io/PHPPresentation/docs/develop/).

Expand Down Expand Up @@ -76,7 +76,7 @@ require_once 'path/to/PhpPresentation/src/PhpPresentation/Autoloader.php';
```

You will also need to download the latest PHPOffice/Common release from its [releases page](https://github.com/PHPOffice/Common/releases).
And you will also have to register its autoloader, too.
And you will also have to register its autoloader, too.

```php
require_once 'path/to/PhpOffice/Common/src/Common/Autoloader.php';
Expand Down Expand Up @@ -130,7 +130,7 @@ $textRun = $shape->createTextRun('Thank you for using PHPPresentation!');
$textRun->getFont()->setBold(true)
->setSize(60)
->setColor( new Color( 'FFE06B20' ) );

$oWriterPPTX = IOFactory::createWriter($objPHPPowerPoint, 'PowerPoint2007');
$oWriterPPTX->save(__DIR__ . "/sample.pptx");
$oWriterODP = IOFactory::createWriter($objPHPPowerPoint, 'ODPresentation');
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"phpoffice/common": "0.2.*"
},
"require-dev": {
"phpunit/phpunit": "3.7.*",
"phpunit/phpunit": "~4.8.36",
"phpdocumentor/phpdocumentor":"2.*",
"phpmd/phpmd": "2.*",
"sebastian/phpcpd": "2.*",
Expand Down
3 changes: 2 additions & 1 deletion tests/PhpPresentation/Tests/AbstractShapeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
use PhpOffice\PhpPresentation\Style\Border;
use PhpOffice\PhpPresentation\Style\Fill;
use PhpOffice\PhpPresentation\Style\Shadow;
use PHPUnit\Framework\TestCase;

/**
* Test class for Autoloader
*/
class AbstractShapeTest extends \PHPUnit_Framework_TestCase
class AbstractShapeTest extends TestCase
{
/**
* Register
Expand Down
3 changes: 2 additions & 1 deletion tests/PhpPresentation/Tests/AutoloaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
namespace PhpOffice\PhpPresentation\Tests;

use PhpOffice\PhpPresentation\Autoloader;
use PHPUnit\Framework\TestCase;

/**
* Test class for Autoloader
*/
class AutoloaderTest extends \PHPUnit_Framework_TestCase
class AutoloaderTest extends TestCase
{
/**
* Register
Expand Down
3 changes: 2 additions & 1 deletion tests/PhpPresentation/Tests/DocumentLayoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
namespace PhpOffice\PhpPresentation\Tests;

use PhpOffice\PhpPresentation\DocumentLayout;
use PHPUnit\Framework\TestCase;

/**
* Test class for DocumentLayout
*
* @coversDefaultClass PhpOffice\PhpPresentation\DocumentLayout
*/
class DocumentLayoutTest extends \PHPUnit_Framework_TestCase
class DocumentLayoutTest extends TestCase
{
/**
* Test create new instance
Expand Down
3 changes: 2 additions & 1 deletion tests/PhpPresentation/Tests/DocumentPropertiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
namespace PhpOffice\PhpPresentation\Tests;

use PhpOffice\PhpPresentation\DocumentProperties;
use PHPUnit\Framework\TestCase;

/**
* Test class for DocumentProperties
*
* @coversDefaultClass PhpOffice\PhpPresentation\DocumentProperties
*/
class DocumentPropertiesTest extends \PHPUnit_Framework_TestCase
class DocumentPropertiesTest extends TestCase
{
/**
* Test get set value
Expand Down
3 changes: 2 additions & 1 deletion tests/PhpPresentation/Tests/HashTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@

use PhpOffice\PhpPresentation\HashTable;
use PhpOffice\PhpPresentation\Slide;
use PHPUnit\Framework\TestCase;

/**
* Test class for HashTable
*
* @coversDefaultClass PhpOffice\PhpPresentation\HashTable
*/
class HashTableTest extends \PHPUnit_Framework_TestCase
class HashTableTest extends TestCase
{
/**
*/
Expand Down
3 changes: 2 additions & 1 deletion tests/PhpPresentation/Tests/IOFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@

use PhpOffice\PhpPresentation\IOFactory;
use PhpOffice\PhpPresentation\PhpPresentation;
use PHPUnit\Framework\TestCase;

/**
* Test class for IOFactory
*
* @coversDefaultClass PhpOffice\PhpPresentation\IOFactory
*/
class IOFactoryTest extends \PHPUnit_Framework_TestCase
class IOFactoryTest extends TestCase
{
/**
* Test create writer
Expand Down
3 changes: 2 additions & 1 deletion tests/PhpPresentation/Tests/PhpPresentationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@
use PhpOffice\PhpPresentation\DocumentProperties;
use PhpOffice\PhpPresentation\PhpPresentation;
use PhpOffice\PhpPresentation\PresentationProperties;
use PHPUnit\Framework\TestCase;

/**
* Test class for PhpPresentation
*
* @coversDefaultClass PhpOffice\PhpPresentation\PhpPresentation
*/
class PhpPresentationTest extends \PHPUnit_Framework_TestCase
class PhpPresentationTest extends TestCase
{
/**
* Test create new instance
Expand Down
3 changes: 2 additions & 1 deletion tests/PhpPresentation/Tests/PresentationPropertiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
namespace PhpOffice\PhpPresentation\Tests;

use PhpOffice\PhpPresentation\PresentationProperties;
use PHPUnit\Framework\TestCase;

/**
* Test class for DocumentProperties
*
* @coversDefaultClass PhpOffice\PhpPresentation\PresentationProperties
*/
class PresentationPropertiesTest extends \PHPUnit_Framework_TestCase
class PresentationPropertiesTest extends TestCase
{
public function testCommentVisible()
{
Expand Down
27 changes: 14 additions & 13 deletions tests/PhpPresentation/Tests/Reader/ODPresentationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,35 @@
use PhpOffice\PhpPresentation\Reader\ODPresentation;
use PhpOffice\PhpPresentation\Style\Alignment;
use PhpOffice\PhpPresentation\Style\Bullet;
use PHPUnit\Framework\TestCase;

/**
* Test class for ODPresentation reader
*
* @coversDefaultClass PhpOffice\PhpPresentation\Reader\ODPresentation
*/
class ODPresentationTest extends \PHPUnit_Framework_TestCase
class ODPresentationTest extends TestCase
{
/**
* Test can read
*/
public function testCanRead()
{
$object = new ODPresentation();

$file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_00_01.ppt';
$this->assertFalse($object->canRead($file));

$file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/serialized.phppt';
$this->assertFalse($object->canRead($file));

$file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_12.pptx';
$this->assertFalse($object->canRead($file));

$file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_12.odp';
$this->assertTrue($object->canRead($file));
}

/**
* @expectedException \Exception
* @expectedExceptionMessage Could not open for reading! File does not exist.
Expand All @@ -57,7 +58,7 @@ public function testLoadFileNotExists()
$object = new ODPresentation();
$object->load('');
}

/**
* @expectedException \Exception
* @expectedExceptionMessage Invalid file format for PhpOffice\PhpPresentation\Reader\ODPresentation:
Expand All @@ -68,7 +69,7 @@ public function testLoadFileBadFormat()
$object = new ODPresentation();
$object->load($file);
}

/**
* @expectedException \Exception
* @expectedExceptionMessage Could not open for reading! File does not exist.
Expand All @@ -78,7 +79,7 @@ public function testFileSupportsNotExists()
$object = new ODPresentation();
$object->fileSupportsUnserializePhpPresentation('');
}

public function testLoadFile01()
{
$file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_12.odp';
Expand All @@ -94,7 +95,7 @@ public function testLoadFile01()
$this->assertEquals('office 2007 openxml libreoffice odt php', $oPhpPresentation->getDocumentProperties()->getKeywords());
//
$this->assertCount(4, $oPhpPresentation->getAllSlides());

// Slide 1
$oSlide1 = $oPhpPresentation->getSlide(0);
$arrayShape = $oSlide1->getShapeCollection();
Expand Down Expand Up @@ -140,7 +141,7 @@ public function testLoadFile01()
$this->assertTrue($oRichText->getFont()->isBold());
$this->assertEquals(60, $oRichText->getFont()->getSize());
$this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB());

// Slide 2
$oSlide2 = $oPhpPresentation->getSlide(1);
$arrayShape = $oSlide2->getShapeCollection();
Expand Down Expand Up @@ -237,7 +238,7 @@ public function testLoadFile01()
$this->assertEquals('Supports writing to different file formats', $oRichText->getText());
$this->assertEquals(36, $oRichText->getFont()->getSize());
$this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB());

// Slide 3
$oSlide2 = $oPhpPresentation->getSlide(2);
$arrayShape = $oSlide2->getShapeCollection();
Expand Down Expand Up @@ -394,7 +395,7 @@ public function testLoadFile01()
$this->assertEquals('... (more to come) ...', $oRichText->getText());
$this->assertEquals(36, $oRichText->getFont()->getSize());
$this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB());

// Slide 4
$oSlide3 = $oPhpPresentation->getSlide(3);
$arrayShape = $oSlide3->getShapeCollection();
Expand Down
25 changes: 13 additions & 12 deletions tests/PhpPresentation/Tests/Reader/PowerPoint2007Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,32 @@
use PhpOffice\PhpPresentation\Reader\PowerPoint2007;
use PhpOffice\PhpPresentation\Style\Alignment;
use PhpOffice\PhpPresentation\Style\Bullet;
use PHPUnit\Framework\TestCase;

/**
* Test class for PowerPoint2007 reader
*
* @coversDefaultClass PhpOffice\PhpPresentation\Reader\PowerPoint2007
*/
class PowerPoint2007Test extends \PHPUnit_Framework_TestCase
class PowerPoint2007Test extends TestCase
{
/**
* Test can read
*/
public function testCanRead()
{
$object = new PowerPoint2007();

$file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_00_01.ppt';
$this->assertFalse($object->canRead($file));

$file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/serialized.phppt';
$this->assertFalse($object->canRead($file));

$file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_12.pptx';
$this->assertTrue($object->canRead($file));
}

/**
* @expectedException \Exception
* @expectedExceptionMessage Could not open for reading! File does not exist.
Expand All @@ -55,7 +56,7 @@ public function testLoadFileNotExists()
$object = new PowerPoint2007();
$object->load('');
}

/**
* @expectedException \Exception
* @expectedExceptionMessage Invalid file format for PhpOffice\PhpPresentation\Reader\PowerPoint2007:
Expand All @@ -66,7 +67,7 @@ public function testLoadFileBadFormat()
$object = new PowerPoint2007();
$object->load($file);
}

/**
* @expectedException \Exception
* @expectedExceptionMessage Could not open for reading! File does not exist.
Expand All @@ -76,7 +77,7 @@ public function testFileSupportsNotExists()
$object = new PowerPoint2007();
$object->fileSupportsUnserializePhpPresentation('');
}

public function testLoadFile01()
{
$file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_12.pptx';
Expand All @@ -98,7 +99,7 @@ public function testLoadFile01()

// Slides
$this->assertCount(4, $oPhpPresentation->getAllSlides());

// Slide 1
$oSlide1 = $oPhpPresentation->getSlide(0);
$arrayShape = $oSlide1->getShapeCollection();
Expand Down Expand Up @@ -144,7 +145,7 @@ public function testLoadFile01()
$this->assertTrue($oRichText->getFont()->isBold());
$this->assertEquals(60, $oRichText->getFont()->getSize());
$this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB());

// Slide 2
$oSlide2 = $oPhpPresentation->getSlide(1);
$arrayShape = $oSlide2->getShapeCollection();
Expand Down Expand Up @@ -241,7 +242,7 @@ public function testLoadFile01()
$this->assertEquals('Supports writing to different file formats', $oRichText->getText());
$this->assertEquals(36, $oRichText->getFont()->getSize());
$this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB());

// Slide 3
$oSlide2 = $oPhpPresentation->getSlide(2);
$arrayShape = $oSlide2->getShapeCollection();
Expand Down Expand Up @@ -398,7 +399,7 @@ public function testLoadFile01()
$this->assertEquals('... (more to come) ...', $oRichText->getText());
$this->assertEquals(36, $oRichText->getFont()->getSize());
$this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB());

// Slide 4
$oSlide3 = $oPhpPresentation->getSlide(3);
$arrayShape = $oSlide3->getShapeCollection();
Expand Down
Loading