public function testSameValueComparisonSucceeds() { $attribute = new TimestampAttribute('somedate', $this->getTypeMock()); $vh1 = $attribute->createValueHolder(); $vh1->setValue('2015-09-09T22:00:00.000000+00:00'); $this->assertFalse($vh1->isNull()); $this->assertFalse($vh1->isDefault()); $this->assertSame('2015-09-09T22:00:00.000000+00:00', $vh1->getValue()->format('Y-m-d\\TH:i:s.uP')); $vh2 = $attribute->createValueHolder(); $vh2->setValue('2015-09-09T22:00:00.000Z'); $this->assertFalse($vh2->isNull()); $this->assertFalse($vh2->isDefault()); $this->assertSame('2015-09-09T22:00:00.000000+00:00', $vh2->getValue()->format('Y-m-d\\TH:i:s.uP')); $this->assertTrue($vh2->sameValueAs($vh1->toNative()), 'Value comparison w/ native value'); $this->assertTrue($vh2->sameValueAs($vh1->getValue()), 'Value comparison w/ value'); $this->assertTrue($vh1->sameValueAs($vh2->toNative()), 'Value comparison w/ native value vice versa'); $this->assertTrue($vh1->sameValueAs($vh2->getValue()), 'Value comparison w/ value vice versa'); }
/** * @dataProvider provideInvalidValues */ public function testInvalidValue($invalid_value, $assert_message = '') { $attribute = new TimestampAttribute('publishedAt', $this->getTypeMock()); $result = $attribute->getValidator()->validate($invalid_value); $this->assertSame(IncidentInterface::ERROR, $result->getSeverity(), $assert_message); }