From 7908c7701edc3766817950ededf08eb9eaebf87a Mon Sep 17 00:00:00 2001 From: "Thomas A. Hirsch" Date: Thu, 25 Jan 2024 11:38:26 +0100 Subject: [PATCH] Changed test to check against a snapshot. --- .../gh110/Ticket_gh110_TestRecord.snapshot | 60 +++++++++++++++++++ tests/Ticket/gh110TestCase.php | 10 ++-- 2 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 tests/Ticket/gh110/Ticket_gh110_TestRecord.snapshot diff --git a/tests/Ticket/gh110/Ticket_gh110_TestRecord.snapshot b/tests/Ticket/gh110/Ticket_gh110_TestRecord.snapshot new file mode 100644 index 000000000..309a3186b --- /dev/null +++ b/tests/Ticket/gh110/Ticket_gh110_TestRecord.snapshot @@ -0,0 +1,60 @@ +/** + * Ticket_gh110_TestRecord + * + * This class has been auto-generated by the Doctrine ORM Framework + * + * @property int $id Type: integer(4) + * @property my_custom_type $created_at Type: my_custom_type + * @property string $deleted_at Type: timestamp, Timestamp in ISO-8601 format (YYYY-MM-DD HH:MI:SS) + * + * @method int getId() Type: integer(4) + * @method my_custom_type getCreatedAt() Type: my_custom_type + * @method string getDeletedAt() Type: timestamp, Timestamp in ISO-8601 format (YYYY-MM-DD HH:MI:SS) + * + * @method Ticket_gh110_TestRecord setId(int $val) Type: integer(4) + * @method Ticket_gh110_TestRecord setCreatedAt(my_custom_type $val) Type: my_custom_type + * @method Ticket_gh110_TestRecord setDeletedAt(string $val) Type: timestamp, Timestamp in ISO-8601 format (YYYY-MM-DD HH:MI:SS) + * + * @package ##PACKAGE## + * @subpackage ##SUBPACKAGE## + * @author ##NAME## <##EMAIL##> + * @version {{REPLACED}} + */ +class Ticket_gh110_TestRecord extends Doctrine_Record +{ + public function setTableDefinition() + { + $this->hasColumn('id', 'integer', 4, array( + 'type' => 'integer', + 'length' => 4, + )); + $this->hasColumn('created_at', 'my_custom_type', null, array( + 'type' => 'my_custom_type', + 'length' => '', + )); + } + + public function setUp() + { + parent::setUp(); + $softdelete0 = new Doctrine_Template_SoftDelete(array( + )); + $timestampable0 = new Doctrine_Template_Timestampable(array( + 'updated' => + array( + 'disabled' => true, + ), + 'unknown_column' => + array( + ), + )); + $unknownactas0 = new UnknownActAs(array( + )); + $gh110_template0 = new Doctrine_Template_gh110_Template(array( + )); + $this->actAs($softdelete0); + $this->actAs($timestampable0); + $this->actAs($unknownactas0); + $this->actAs($gh110_template0); + } +} \ No newline at end of file diff --git a/tests/Ticket/gh110TestCase.php b/tests/Ticket/gh110TestCase.php index 8eab1f5d3..65c15b0eb 100644 --- a/tests/Ticket/gh110TestCase.php +++ b/tests/Ticket/gh110TestCase.php @@ -36,11 +36,11 @@ public function testAddActAsColumnsToDocBlock() ) ); - $this->assertTrue(preg_match('/@property int\s*\$id/', $class)); - $this->assertTrue(preg_match('/@property string\s*\$deleted_at/', $class)); - $this->assertTrue(preg_match('/@property my_custom_type\s*\$created_at/', $class)); - $this->assertFalse(preg_match('/@property string\s*\$created_at/', $class)); - $this->assertFalse(preg_match('/@property string\s*\$updated_at/', $class)); + // We must replace the version as there is a timestamp in it. + $class = preg_replace('/^.*@version.*$/m', ' * @version {{REPLACED}}', $class); + // Can be used to update the snapshot. + //file_put_contents(dirname(__FILE__) . '/gh110/Ticket_gh110_TestRecord.snapshot', $class); + $this->assertEqual($class, file_get_contents(dirname(__FILE__) . '/gh110/Ticket_gh110_TestRecord.snapshot')); } }