Written DataValidation was corrupted

Fixes #290
This commit is contained in:
Adrien Crivelli 2017-12-16 17:15:13 +09:00
parent 04a8ddffa2
commit eb58563b4b
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
3 changed files with 22 additions and 2 deletions

View File

@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed ### Fixed
- Can read very small HTML files - [#194](https://github.com/PHPOffice/PhpSpreadsheet/issues/194) - Can read very small HTML files - [#194](https://github.com/PHPOffice/PhpSpreadsheet/issues/194)
- Written DataValidation was corrupted - [#290](https://github.com/PHPOffice/PhpSpreadsheet/issues/290)
### BREAKING CHANGE ### BREAKING CHANGE

View File

@ -449,8 +449,8 @@ class DataValidation
return md5( return md5(
$this->formula1 . $this->formula1 .
$this->formula2 . $this->formula2 .
$this->type = self::TYPE_NONE . $this->type .
$this->errorStyle = self::STYLE_STOP . $this->errorStyle .
$this->operator . $this->operator .
($this->allowBlank ? 't' : 'f') . ($this->allowBlank ? 't' : 'f') .
($this->showDropDown ? 't' : 'f') . ($this->showDropDown ? 't' : 'f') .

View File

@ -0,0 +1,19 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Cell;
use PhpOffice\PhpSpreadsheet\Cell\DataValidation;
use PHPUnit\Framework\TestCase;
class DataValidationTest extends TestCase
{
public function testNoValidation()
{
$dataValidation = new DataValidation();
self::assertSame('090624f04837265d79323c4a1b7e89d1', $dataValidation->getHashCode());
$dataValidation->setType(DataValidation::TYPE_CUSTOM);
self::assertSame('778f6c9e0ffcd5eaa7d8e1432d67f919', $dataValidation->getHashCode());
self::assertSame('778f6c9e0ffcd5eaa7d8e1432d67f919', $dataValidation->getHashCode(), 'getHashCode() should not have side effect');
}
}