CellCollectionTest.php 805 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. class CellCollectionTest extends PHPUnit_Framework_TestCase
  3. {
  4. public function setUp()
  5. {
  6. if (!defined('PHPEXCEL_ROOT'))
  7. {
  8. define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
  9. }
  10. require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
  11. }
  12. public function testCacheLastCell()
  13. {
  14. $methods = PHPExcel_CachedObjectStorageFactory::getCacheStorageMethods();
  15. foreach ($methods as $method) {
  16. PHPExcel_CachedObjectStorageFactory::initialize($method);
  17. $workbook = new PHPExcel();
  18. $cells = array('A1', 'A2');
  19. $worksheet = $workbook->getActiveSheet();
  20. $worksheet->setCellValue('A1', 1);
  21. $worksheet->setCellValue('A2', 2);
  22. $this->assertEquals($cells, $worksheet->getCellCollection(), "Cache method \"$method\".");
  23. PHPExcel_CachedObjectStorageFactory::finalize();
  24. }
  25. }
  26. }