RoundIdTest.php 927 Bytes
<?php

namespace FootyRoom\Tests\Unit\Predictor;

use DateTime;
use FootyRoom\Tests\TestCase;
use FootyRoom\Core\Predictor\RoundId;

class RoundIdTest extends TestCase
{
    public function test_it_transforms_DateTime_to_string_representation_of_round()
    {
        $this->assertEquals((new RoundId(new DateTime('2018-02-03T20:00:00')))->getValue(), '2018-W05');
        $this->assertEquals((new RoundId(new DateTime('2018-02-12T20:00:00')))->getValue(), '2018-W07');
    }

    public function test_it_can_be_casted_to_string()
    {
        $this->assertEquals((string) (new RoundId(new DateTime('2018-02-03T20:00:00'))), '2018-W05');
        $this->assertEquals((string) (new RoundId(new DateTime('2018-02-12T20:00:00'))), '2018-W07');
    }

    public function test_it_can_give_your_current_round_id()
    {
        $this->assertEquals((new RoundId(new DateTime()))->getValue(), RoundId::current()->getValue());
    }
}