1 | <?php |
||
8 | class DuplicationTest extends DatabaseTestCase |
||
9 | { |
||
10 | protected static $migrationFileName = 'sqlite_with_dublication.sql'; |
||
11 | |||
12 | public function testFindAndSave() |
||
34 | |||
35 | public function testCreate() |
||
36 | { |
||
37 | $post = new Post([ |
||
38 | 'title' => 'New post title', |
||
39 | 'body' => 'New post body', |
||
40 | 'title_en' => 'New post title en', |
||
41 | 'body_en' => 'New post body en', |
||
42 | 'title_ru' => 'New post title ru', //this value should be overwritten by default language value |
||
43 | 'body_ru' => 'New post body ru', |
||
44 | ]); |
||
45 | |||
46 | $this->assertTrue($post->save()); |
||
47 | $dataSet = $this->getConnection()->createDataSet(['post', 'postLang']); |
||
48 | $expectedDataSet = $this->createFlatXMLDataSet(__DIR__ . '/data/test-create-post-set-translations-dublication.xml'); |
||
49 | $this->assertDataSetsEqual($expectedDataSet, $dataSet); |
||
50 | |||
51 | $post = new Post([ |
||
52 | 'title' => 'New post title', |
||
53 | 'body' => 'New post body', |
||
54 | ]); |
||
55 | |||
56 | $this->assertTrue($post->save()); |
||
57 | $post = Post::findOne($post->id); |
||
58 | $this->assertNotNull($post->title); |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * @inheritdoc |
||
63 | */ |
||
64 | public function getDataSet() |
||
68 | } |
||
69 |