@@ 117-138 (lines=22) @@ | ||
114 | $this->assertDataSetsEqual($expectedDataSet, $dataSet); |
|
115 | } |
|
116 | ||
117 | public function testCreatePostSetTranslations() |
|
118 | { |
|
119 | $post = new Post(); |
|
120 | $data = [ |
|
121 | 'title' => 'New post title', |
|
122 | 'body' => 'New post body', |
|
123 | 'title_en' => 'New post title en', |
|
124 | 'body_en' => 'New post body en', |
|
125 | 'title_ru' => 'New post title ru', //this value should be overwritten by default language value |
|
126 | 'body_ru' => 'New post body ru', |
|
127 | ]; |
|
128 | $formName = $post->formName(); |
|
129 | if (!empty($formName)) { |
|
130 | $data = [$formName => $data]; |
|
131 | } |
|
132 | $post->load($data); |
|
133 | ||
134 | $this->assertTrue($post->save()); |
|
135 | $dataSet = $this->getConnection()->createDataSet(['post', 'postLang']); |
|
136 | $expectedDataSet = $this->createFlatXMLDataSet(__DIR__ . '/data/test-create-post-set-translations.xml'); |
|
137 | $this->assertDataSetsEqual($expectedDataSet, $dataSet); |
|
138 | } |
|
139 | ||
140 | public function testUpdateNotPopulatedPost() |
|
141 | { |
@@ 41-62 (lines=22) @@ | ||
38 | $this->assertDataSetsEqual($expectedDataSet, $dataSet); |
|
39 | } |
|
40 | ||
41 | public function testCreatePostSetTranslations() |
|
42 | { |
|
43 | $post = new Post(); |
|
44 | $data = [ |
|
45 | 'title' => 'New post title', |
|
46 | 'body' => 'New post body', |
|
47 | 'title_en_us' => 'New post title en', |
|
48 | 'body_en_us' => 'New post body en', |
|
49 | 'title_ru' => 'New post title ru', //this value should be overwritten by default language value |
|
50 | 'body_ru' => 'New post body ru', |
|
51 | ]; |
|
52 | $formName = $post->formName(); |
|
53 | if (!empty($formName)) { |
|
54 | $data = [$formName => $data]; |
|
55 | } |
|
56 | $post->load($data); |
|
57 | ||
58 | $this->assertTrue($post->save()); |
|
59 | $dataSet = $this->getConnection()->createDataSet(['post', 'postLang']); |
|
60 | $expectedDataSet = $this->createFlatXMLDataSet(__DIR__ . '/data/test-create-post-set-translations-na.xml'); |
|
61 | $this->assertDataSetsEqual($expectedDataSet, $dataSet); |
|
62 | } |
|
63 | ||
64 | public function testUpdateNotPopulatedPost() |
|
65 | { |