Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
954dd2f
commit 133e020
Showing
3 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace PhpParser\Node\Scalar; | ||
|
||
use PhpParser\Node\Stmt\Echo_; | ||
use PhpParser\ParserFactory; | ||
|
||
class DNumberTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
public function testRawValue() | ||
{ | ||
$parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7); | ||
$nodes = $parser->parse('<?php echo 1_234.56;'); | ||
|
||
$echo = $nodes[0]; | ||
$this->assertInstanceOf(Echo_::class, $echo); | ||
|
||
/** @var Echo_ $echo */ | ||
$lLumber = $echo->exprs[0]; | ||
$this->assertInstanceOf(DNumber::class, $lLumber); | ||
|
||
/** @var DNumber $dnumber */ | ||
$this->assertSame(1234.56, $lLumber->value); | ||
$this->assertSame('1_234.56', $lLumber->rawValue); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters