8
8
9
9
use Doctrine \DBAL \Schema \SchemaException ;
10
10
use Doctrine \ORM \Tools \SchemaTool ;
11
+ use NilPortugues \Tests \Api \JsonApi \Integrations \Doctrine \Entity \Customer ;
12
+ use NilPortugues \Tests \Api \JsonApi \Integrations \Doctrine \Mappings \CustomerMapping ;
13
+ use NilPortugues \Tests \Api \JsonApi \Integrations \Doctrine \Mappings \PostMapping ;
14
+ use NilPortugues \Tests \Api \JsonApi \Integrations \Doctrine \Mappings \CommentMapping ;
15
+ use NilPortugues \Tests \Api \JsonApi \Integrations \Doctrine \Entity \Post ;
16
+ use NilPortugues \Tests \Api \JsonApi \Integrations \Doctrine \Entity \Comment ;
11
17
12
18
require_once 'bootstrap.php ' ;
13
19
@@ -17,13 +23,44 @@ abstract class AbstractTestCase extends \PHPUnit_Framework_TestCase
17
23
* @var \Doctrine\ORM\EntityManager
18
24
*/
19
25
protected static $ entityManager ;
26
+ protected static $ classConfig ;
20
27
21
28
public static function setUpBeforeClass ()
22
29
{
23
30
self ::$ entityManager = GetEntityManager ();
24
31
// Build the schema for sqlite
25
32
self ::generateSchema ();
26
33
34
+ $ newCustomer = new Customer ();
35
+ $ newCustomer ->setActive (true );
36
+ $ newCustomer ->setName ('Name 1 ' );
37
+ self ::$ entityManager ->persist ($ newCustomer );
38
+
39
+ $ newPost = new Post ();
40
+ $ newPost ->setCustomer ($ newCustomer );
41
+ $ newPost ->setDate (new \DateTime ('2016-07-12 16:30:12.000000 ' ));
42
+ $ newPost ->setDescription ('Description test ' );
43
+ self ::$ entityManager ->persist ($ newPost );
44
+
45
+ $ newComment = new Comment ();
46
+ $ newComment ->setPost ($ newPost );
47
+ $ newComment ->setComment ('Comment 1 ' );
48
+ self ::$ entityManager ->persist ($ newComment );
49
+
50
+ $ newComment2 = new Comment ();
51
+ $ newComment2 ->setPost ($ newPost );
52
+ $ newComment2 ->setComment ('Comment 2 ' );
53
+ $ newComment2 ->setParentComment ($ newComment );
54
+ self ::$ entityManager ->persist ($ newComment2 );
55
+
56
+ self ::$ entityManager ->flush ();
57
+
58
+ self ::$ classConfig = [
59
+ CustomerMapping::class,
60
+ PostMapping::class,
61
+ CommentMapping::class,
62
+ ];
63
+
27
64
parent ::setUpBeforeClass ();
28
65
}
29
66
0 commit comments