Remove @expectedException annotation

This commit is contained in:
Adrien Loison committed 2017-11-05 02:21:09 +01:00
1 parent 7274226b75
commit 3851e05f83
20 files changed
+173 -74

No files matched your search

+3 -1
View File
@@ -5,6 +5,7 @@ namespace Box\Spout\Writer\ODS;
use Box\Spout\Common\Type;
use Box\Spout\TestUsingResource;
use Box\Spout\Writer\Common\Entity\Sheet;
use Box\Spout\Writer\Exception\InvalidSheetNameException;
use Box\Spout\Writer\RowCreationHelper;
use Box\Spout\Writer\WriterFactory;
@@ -53,11 +54,12 @@ class SheetTest extends \PHPUnit_Framework_TestCase
}
/**
* @expectedException \Box\Spout\Writer\Exception\InvalidSheetNameException
* @return void
*/
public function testSetSheetNameShouldThrowWhenNameIsAlreadyUsed()
{
$this->expectException(InvalidSheetNameException::class);
$fileName = 'test_set_name_with_non_unique_name.ods';
$this->createGeneratedFolderIfNeeded($fileName);
$resourcePath = $this->getGeneratedResourcePath($fileName);
+22 -6
View File
@@ -2,6 +2,8 @@
namespace Box\Spout\Writer\ODS;
use Box\Spout\Common\Exception\InvalidArgumentException;
use Box\Spout\Common\Exception\IOException;
use Box\Spout\Common\Exception\SpoutException;
use Box\Spout\Common\Type;
use Box\Spout\Reader\Wrapper\XMLReader;
@@ -9,6 +11,8 @@ use Box\Spout\TestUsingResource;
use Box\Spout\Writer\Common\Entity\Cell;
use Box\Spout\Writer\Common\Entity\Row;
use Box\Spout\Writer\Common\Helper\ZipHelper;
use Box\Spout\Writer\Exception\WriterAlreadyOpenedException;
use Box\Spout\Writer\Exception\WriterNotOpenedException;
use Box\Spout\Writer\RowCreationHelper;
use Box\Spout\Writer\WriterFactory;
@@ -21,10 +25,12 @@ class WriterTest extends \PHPUnit_Framework_TestCase
use RowCreationHelper;
/**
* @expectedException \Box\Spout\Common\Exception\IOException
* @return void
*/
public function testAddRowShouldThrowExceptionIfCannotOpenAFileForWriting()
{
$this->expectException(IOException::class);
$fileName = 'file_that_wont_be_written.ods';
$this->createUnwritableFolderIfNeeded();
$filePath = $this->getGeneratedUnwritableResourcePath($fileName);
@@ -34,28 +40,34 @@ class WriterTest extends \PHPUnit_Framework_TestCase
}
/**
* @expectedException \Box\Spout\Writer\Exception\WriterNotOpenedException
* @return void
*/
public function testAddRowShouldThrowExceptionIfCallAddRowBeforeOpeningWriter()
{
$this->expectException(WriterNotOpenedException::class);
$writer = WriterFactory::create(Type::ODS);
$writer->addRow($this->createRowFromValues(['ods--11', 'ods--12']));
}
/**
* @expectedException \Box\Spout\Writer\Exception\WriterNotOpenedException
* @return void
*/
public function testAddRowShouldThrowExceptionIfCalledBeforeOpeningWriter()
{
$this->expectException(WriterNotOpenedException::class);
$writer = WriterFactory::create(Type::ODS);
$writer->addRows([$this->createRowFromValues(['ods--11', 'ods--12'])]);
}
/**
* @expectedException \Box\Spout\Writer\Exception\WriterAlreadyOpenedException
* @return void
*/
public function testSetTempFolderShouldThrowExceptionIfCalledAfterOpeningWriter()
{
$this->expectException(WriterAlreadyOpenedException::class);
$fileName = 'file_that_wont_be_written.ods';
$filePath = $this->getGeneratedResourcePath($fileName);
@@ -67,10 +79,12 @@ class WriterTest extends \PHPUnit_Framework_TestCase
}
/**
* @expectedException \Box\Spout\Writer\Exception\WriterAlreadyOpenedException
* @return void
*/
public function testSetShouldCreateNewSheetsAutomaticallyShouldThrowExceptionIfCalledAfterOpeningWriter()
{
$this->expectException(WriterAlreadyOpenedException::class);
$fileName = 'file_that_wont_be_written.ods';
$filePath = $this->getGeneratedResourcePath($fileName);
@@ -82,10 +96,12 @@ class WriterTest extends \PHPUnit_Framework_TestCase
}
/**
* @expectedException \Box\Spout\Common\Exception\InvalidArgumentException
* @return void
*/
public function testAddRowShouldThrowExceptionIfUnsupportedDataTypePassedIn()
{
$this->expectException(InvalidArgumentException::class);
$fileName = 'test_add_row_should_throw_exception_if_unsupported_data_type_passed_in.ods';
$dataRows = [
$this->createRowFromValues([new \stdClass()]),
@@ -11,6 +11,7 @@ use Box\Spout\Writer\Common\Entity\Row;
use Box\Spout\Writer\Common\Entity\Style\Border;
use Box\Spout\Writer\Common\Entity\Style\Color;
use Box\Spout\Writer\Common\Entity\Style\Style;
use Box\Spout\Writer\Exception\WriterNotOpenedException;
use Box\Spout\Writer\RowCreationHelper;
use Box\Spout\Writer\WriterFactory;
@@ -34,19 +35,23 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase
}
/**
* @expectedException \Box\Spout\Writer\Exception\WriterNotOpenedException
* @return void
*/
public function testAddRowWithStyleShouldThrowExceptionIfCallAddRowBeforeOpeningWriter()
{
$this->expectException(WriterNotOpenedException::class);
$writer = WriterFactory::create(Type::ODS);
$writer->addRow($this->createStyledRowFromValues(['ods--11', 'ods--12'], $this->defaultStyle));
}
/**
* @expectedException \Box\Spout\Writer\Exception\WriterNotOpenedException
* @return void
*/
public function testAddRowWithStyleShouldThrowExceptionIfCalledBeforeOpeningWriter()
{
$this->expectException(WriterNotOpenedException::class);
$writer = WriterFactory::create(Type::ODS);
$writer->addRow($this->createStyledRowFromValues(['ods--11', 'ods--12'], $this->defaultStyle));
}