Skip to content

Commit 7908c77

Browse files
committed
Changed test to check against a snapshot.
1 parent 3e49b73 commit 7908c77

File tree

2 files changed

+65
-5
lines changed

2 files changed

+65
-5
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* Ticket_gh110_TestRecord
3+
*
4+
* This class has been auto-generated by the Doctrine ORM Framework
5+
*
6+
* @property int $id Type: integer(4)
7+
* @property my_custom_type $created_at Type: my_custom_type
8+
* @property string $deleted_at Type: timestamp, Timestamp in ISO-8601 format (YYYY-MM-DD HH:MI:SS)
9+
*
10+
* @method int getId() Type: integer(4)
11+
* @method my_custom_type getCreatedAt() Type: my_custom_type
12+
* @method string getDeletedAt() Type: timestamp, Timestamp in ISO-8601 format (YYYY-MM-DD HH:MI:SS)
13+
*
14+
* @method Ticket_gh110_TestRecord setId(int $val) Type: integer(4)
15+
* @method Ticket_gh110_TestRecord setCreatedAt(my_custom_type $val) Type: my_custom_type
16+
* @method Ticket_gh110_TestRecord setDeletedAt(string $val) Type: timestamp, Timestamp in ISO-8601 format (YYYY-MM-DD HH:MI:SS)
17+
*
18+
* @package ##PACKAGE##
19+
* @subpackage ##SUBPACKAGE##
20+
* @author ##NAME## <##EMAIL##>
21+
* @version {{REPLACED}}
22+
*/
23+
class Ticket_gh110_TestRecord extends Doctrine_Record
24+
{
25+
public function setTableDefinition()
26+
{
27+
$this->hasColumn('id', 'integer', 4, array(
28+
'type' => 'integer',
29+
'length' => 4,
30+
));
31+
$this->hasColumn('created_at', 'my_custom_type', null, array(
32+
'type' => 'my_custom_type',
33+
'length' => '',
34+
));
35+
}
36+
37+
public function setUp()
38+
{
39+
parent::setUp();
40+
$softdelete0 = new Doctrine_Template_SoftDelete(array(
41+
));
42+
$timestampable0 = new Doctrine_Template_Timestampable(array(
43+
'updated' =>
44+
array(
45+
'disabled' => true,
46+
),
47+
'unknown_column' =>
48+
array(
49+
),
50+
));
51+
$unknownactas0 = new UnknownActAs(array(
52+
));
53+
$gh110_template0 = new Doctrine_Template_gh110_Template(array(
54+
));
55+
$this->actAs($softdelete0);
56+
$this->actAs($timestampable0);
57+
$this->actAs($unknownactas0);
58+
$this->actAs($gh110_template0);
59+
}
60+
}

tests/Ticket/gh110TestCase.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ public function testAddActAsColumnsToDocBlock()
3636
)
3737
);
3838

39-
$this->assertTrue(preg_match('/@property int\s*\$id/', $class));
40-
$this->assertTrue(preg_match('/@property string\s*\$deleted_at/', $class));
41-
$this->assertTrue(preg_match('/@property my_custom_type\s*\$created_at/', $class));
42-
$this->assertFalse(preg_match('/@property string\s*\$created_at/', $class));
43-
$this->assertFalse(preg_match('/@property string\s*\$updated_at/', $class));
39+
// We must replace the version as there is a timestamp in it.
40+
$class = preg_replace('/^.*@version.*$/m', ' * @version {{REPLACED}}', $class);
41+
// Can be used to update the snapshot.
42+
//file_put_contents(dirname(__FILE__) . '/gh110/Ticket_gh110_TestRecord.snapshot', $class);
43+
$this->assertEqual($class, file_get_contents(dirname(__FILE__) . '/gh110/Ticket_gh110_TestRecord.snapshot'));
4444
}
4545
}
4646

0 commit comments

Comments
 (0)