3v4l.org

run code in 300+ PHP versions simultaneously
<?php <?php namespace PokerHand; use PHPUnit\Framework\TestCase; class PokerHandTest extends TestCase { /** * @test */ public function itCanRankARoyalFlush() { $hand = new PokerHand('As Ks Qs Js 10s'); $this->assertEquals('Royal Flush', $hand->getRank()); } /** * @test */ public function itCanRankAStraightFlush() { $hand = new PokerHand('8s 7s 6s 5s 4s'); $this->assertEquals('Straight Flush', $hand->getRank()); } /** * @test */ public function itCanRankAFourOfAKind() { $hand = new PokerHand('Js Jc Jd Jh 7s'); $this->assertEquals('Four of a Kind', $hand->getRank()); } /** * @test */ public function itCanRankFullHouse() { $hand = new PokerHand('10s 10d 10c 9s 9d'); $this->assertEquals('Full House', $hand->getRank()); } /** * @test */ public function itCanRankAFlush() { $hand = new PokerHand('Kh Qh 6h 2h 9h'); $this->assertEquals('Flush', $hand->getRank()); } /** * @test */ public function itCanRankAStraight() { $hand = new PokerHand('9c 8d 7s 6d 5h'); $this->assertEquals('Straight', $hand->getRank()); } /** * @test */ public function itCanRankAThreeOfAKindh() { $hand = new PokerHand('7c 7d 7s Ks 3s'); $this->assertEquals('Three of a Kind', $hand->getRank()); } /** * @test */ public function itCanRankATwoPair() { $hand = new PokerHand('Kh Kc 3s 3h 2d'); $this->assertEquals('Two Pair', $hand->getRank()); } /** * @test */ public function itCanRankAOnePair() { $hand = new PokerHand('Ah As 10c 7d 6s'); $this->assertEquals('One Pair', $hand->getRank()); } /** * @test */ public function itCanRankAHighCard() { $hand = new PokerHand('9h 6c 7d 2s Qh'); $this->assertEquals('High Card', $hand->getRank()); } } $ composer test-poker > phpunit --verbose --colors=always test/PokerHandTest.php PHPUnit 7.3.5 by Sebastian Bergmann and contributors. Runtime: PHP 7.2.17-0ubuntu0.18.04.1 with Xdebug 2.6.0 .......... 10 / 10 (100%) Time: 50 ms, Memory: 4.00MB OK (10 tests, 10 assertions)
Output for 7.1.25 - 7.1.28, 7.2.0 - 7.2.17, 7.3.0 - 7.3.4
Parse error: syntax error, unexpected '<', expecting end of file in /in/BFvIF on line 3
Process exited with code 255.

preferences:
174.36 ms | 1395 KiB | 34 Q