Unverified Commit 4e5e47e2 authored by Sergei Morozov's avatar Sergei Morozov

Merge branch 'bpo/2.8/3268' into 2.8

parents a7dc38d8 334cc7d9
...@@ -57,8 +57,8 @@ class Sequence extends AbstractAsset ...@@ -57,8 +57,8 @@ class Sequence extends AbstractAsset
public function __construct($name, $allocationSize = 1, $initialValue = 1, $cache = null) public function __construct($name, $allocationSize = 1, $initialValue = 1, $cache = null)
{ {
$this->_setName($name); $this->_setName($name);
$this->allocationSize = is_numeric($allocationSize) ? $allocationSize : 1; $this->setAllocationSize($allocationSize);
$this->initialValue = is_numeric($initialValue) ? $initialValue : 1; $this->setInitialValue($initialValue);
$this->cache = $cache; $this->cache = $cache;
} }
...@@ -93,7 +93,7 @@ class Sequence extends AbstractAsset ...@@ -93,7 +93,7 @@ class Sequence extends AbstractAsset
*/ */
public function setAllocationSize($allocationSize) public function setAllocationSize($allocationSize)
{ {
$this->allocationSize = is_numeric($allocationSize) ? $allocationSize : 1; $this->allocationSize = is_numeric($allocationSize) ? (int) $allocationSize : 1;
return $this; return $this;
} }
...@@ -105,7 +105,7 @@ class Sequence extends AbstractAsset ...@@ -105,7 +105,7 @@ class Sequence extends AbstractAsset
*/ */
public function setInitialValue($initialValue) public function setInitialValue($initialValue)
{ {
$this->initialValue = is_numeric($initialValue) ? $initialValue : 1; $this->initialValue = is_numeric($initialValue) ? (int) $initialValue : 1;
return $this; return $this;
} }
......
...@@ -435,11 +435,13 @@ class ComparatorTest extends \PHPUnit\Framework\TestCase ...@@ -435,11 +435,13 @@ class ComparatorTest extends \PHPUnit\Framework\TestCase
$seq1 = new Sequence('foo', 1, 1); $seq1 = new Sequence('foo', 1, 1);
$seq2 = new Sequence('foo', 1, 2); $seq2 = new Sequence('foo', 1, 2);
$seq3 = new Sequence('foo', 2, 1); $seq3 = new Sequence('foo', 2, 1);
$seq4 = new Sequence('foo', '1', '1');
$c = new Comparator(); $c = new Comparator();
self::assertTrue($c->diffSequence($seq1, $seq2)); self::assertTrue($c->diffSequence($seq1, $seq2));
self::assertTrue($c->diffSequence($seq1, $seq3)); self::assertTrue($c->diffSequence($seq1, $seq3));
self::assertFalse($c->diffSequence($seq1, $seq4));
} }
public function testRemovedSequence() public function testRemovedSequence()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment