Ejemplo n.º 1
0
 /**
  * @test
  */
 public function convertFromSupportsDateTimeSubClasses()
 {
     $className = DateTimeSubFixture::class;
     $date = $this->converter->convertFrom('2005-08-15T15:52:01+00:00', $className);
     $this->assertInstanceOf($className, $date);
     $this->assertSame('Bar', $date->foo());
 }
Ejemplo n.º 2
0
    /**
     * @test
     */
    public function convertFromSupportsDateTimeSubClasses()
    {
        $className = $this->getUniqueId('DateTimeSubClass');
        eval('
			class ' . $className . ' extends \\DateTime {
				static public function createFromFormat($format, $time, $timezone = NULL) {
					return new ' . $className . '();
				}
				public function foo() { return "Bar"; }
			}
		');
        $date = $this->converter->convertFrom('2005-08-15T15:52:01+00:00', $className);
        $this->assertInstanceOf($className, $date);
        $this->assertSame('Bar', $date->foo());
    }