Passed
Push — developer ( 6b5868...bed0f9 )
by Radosław
22:42 queued 03:39
created

RecordConverter::testInitialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 21
rs 9.7666
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * RecordConverter test file.
4
 *
5
 * @package   Tests
6
 *
7
 * @copyright YetiForce S.A.
8
 * @license   YetiForce Public License 6.5 (licenses/LicenseEN.txt or yetiforce.com)
9
 * @author    Mariusz Krzaczkowski <[email protected]>
10
 */
11
12
namespace Tests\App;
13
14
/**
15
 * RecordConverter test class.
16
 */
17
class RecordConverter extends \Tests\Base
18
{
19
	/**
20
	 * Initialize test.
21
	 */
22
	public function testInitialize()
23
	{
24
		$dbCommand = \App\Db::getInstance('admin')->createCommand();
25
		$dbCommand->insert(
26
			'a_yf_record_converter',
27
			[
28
				'name' => 'Record converter test',
29
				'status' => 1,
30
				'source_module' => 89,
31
				'destiny_module' => 90,
32
				'field_mapping' => \App\Json::encode(
33
					['auto']
34
				),
35
				'inv_field_mapping' => \App\Json::encode(
36
					['auto']
37
				),
38
				'show_in_list' => 1,
39
				'show_in_detail' => 1,
40
			]
41
		)->execute();
42
		$this->assertTrue(\App\RecordConverter::isActive('SQuotes', 'Detail'));
43
	}
44
45
	/**
46
	 * Process test.
47
	 */
48
	public function testProcess()
49
	{
50
		$this->markTestSkipped('unfinished');
51
		// $id = (new \App\Db\Query())->select(['squotesid'])->from('u_#__squotes')->scalar();
52
		// if ($id) {
53
			// $recordModel = \Vtiger_Record_Model::getInstanceById($id, 'SQuotes');
54
			// $this->logs = [
55
			// 	'data' => $recordModel->getData(),
56
			// 	'inventory' => $recordModel->getInventoryData(),
57
			// ];
58
			// $convertInstance = \App\RecordConverter::getInstanceById(1);
59
			// $convertInstance->process([$id]);
60
61
			// $this->assertCount(1, $convertInstance->createdRecords);
62
			// foreach ($convertInstance->createdRecords as $id) {
63
			// 	$this->assertTrue((new \App\Db\Query())->from('u_yf_ssingleorders')->where(['ssingleordersid' => $id])->exists());
64
			// }
65
		// }
66
	}
67
}
68