<?php
namespace nur\data\types;

use nur\t\TestCase;

class CTimeslotTypeTest extends TestCase {
  function test() {
    $type = new CTimeslotType();

    self::assertSame(null, $type->with(null));
    self::assertSame(false, $type->with(false));
    self::assertSame(null, $type->with(""));
    self::assertSame([
      "ts_start" => "15h00",
      "ts_end" => "20h00",
    ], $type->with("15-20"));
    self::assertSame([
      "ts_start" => "15h00",
      "ts_end" => null,
    ], $type->with("15"));
    self::assertSame([
      "ts_start" => "15h00",
      "ts_end" => null,
    ], $type->with("15-"));
    self::assertSame([
      "ts_start" => null,
      "ts_end" => "20h00",
    ], $type->with("-20"));
  }
}
