/** * Test for methods: `Field::date()`, `Field::dateTime()`, * `Field::timestamp()`, `Field::time()`. * * @since 1.0.0 * @access public * * @requires function Freyja\Database\Schema\Field::__construct * @requires function Freyja\Database\Schema\Field::date * @requires function Freyja\Database\Schema\Field::dateTime * @requires function Freyja\Database\Schema\Field::timestamp * @requires function Freyja\Database\Schema\Field::time * @requires function ReflectionProperty::setAccessible * @requires function ReflectionProperty::getValue */ public function testTimeMethods() { // Set accessibility to object property. $reflection_type = new ReflectionProperty('Freyja\\Database\\Schema\\Field', 'type'); $reflection_type->setAccessible(true); $field = new Field('name'); $field->date(); $date_retrieved_type = $reflection_type->getValue($field); $this->assertEquals('DATE', $date_retrieved_type, 'Failed asserting that Field::date() correctly set the field type.'); $field = new Field('name'); $field->dateTime(); $datetime_retrieved_type = $reflection_type->getValue($field); $this->assertEquals('DATETIME', $datetime_retrieved_type, 'Failed asserting that Field::dateTime() correctly set the field type.'); $field = new Field('name'); $field->timestamp(); $timestamp_retrieved_type = $reflection_type->getValue($field); $this->assertEquals('TIMESTAMP', $timestamp_retrieved_type, 'Failed asserting that Field::timestamp() correctly set the field type.'); $field = new Field('name'); $field->time(); $time_retrieved_type = $reflection_type->getValue($field); $this->assertEquals('TIME', $time_retrieved_type, 'Failed asserting that Field::time() correctly set the field type.'); }