Skip to content

Commit

Permalink
#828 - Add extra test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeckerson committed Apr 5, 2021
1 parent 5152dd9 commit e318c1d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
9 changes: 7 additions & 2 deletions stub/cast.zep
Original file line number Diff line number Diff line change
Expand Up @@ -486,15 +486,20 @@ class Cast
public function testIssue828() -> array
{
array ret = [];
var version = "1.0 200 OK", floatVersion, intVersion;
var version = "1.0 200 OK", nonNumericString = "OK", floatVersion, intVersion, floatNonNumeric, intNonNumeric;

let ret[] = version;
let ret[] = nonNumericString;

let floatVersion = (double)version,
intVersion = (int)version;
intVersion = (int)version,
floatNonNumeric = (double)nonNumericString,
intNonNumeric = (int)nonNumericString;

let ret[] = floatVersion;
let ret[] = intVersion;
let ret[] = floatNonNumeric;
let ret[] = intNonNumeric;

return ret;
}
Expand Down
9 changes: 6 additions & 3 deletions tests/Extension/CastTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,12 @@ public function testIssue828(): void
{
$return = $this->test->testIssue828();

$this->assertSame(['1.0 200 OK', 1.0, 1], $return);
$this->assertSame(['1.0 200 OK', 'OK', 1.0, 1, 0.0, 0], $return);
$this->assertSame('1.0 200 OK', $return[0]);
$this->assertSame(1.0, $return[1]);
$this->assertSame(1, $return[2]);
$this->assertSame('OK', $return[1]);
$this->assertSame(1.0, $return[2]);
$this->assertSame(1, $return[3]);
$this->assertSame(0.0, $return[4]);
$this->assertSame(0, $return[5]);
}
}

0 comments on commit e318c1d

Please sign in to comment.