Method testRecordModel
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testRecordModel()
{
$recordModel = \Settings_Currency_Record_Model::getInstance(self::$id);
$this->assertNotNull($recordModel, 'Expected recordModel is not empty');
$this->assertNotEmpty($recordModel->getName(), 'Expected name is not empty');
Missing class import via use statement (line '28', column '22'). Open
$recordModel = new \Settings_Currency_Record_Model();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '37', column '15'). Open
$row = (new \App\Db\Query())->from('vtiger_currency_info')->where(['id' => self::$id])->one();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '129', column '26'). Open
$this->assertTrue((new \App\Db\Query())->from('vtiger_currency_info')->where(['and', ['id' => self::$id, 'deleted' => 1]])->exists());
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '130', column '26'). Open
$this->assertTrue((new \App\Db\Query())->from('vtiger_currency_info')->where(['and', ['currency_name' => 'Argentina', 'deleted' => 1]])->exists());
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '60', column '15'). Open
$row = (new \App\Db\Query())->from('vtiger_currency_info')->where(['id' => self::$id])->one();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using static access to class '\Settings_Currency_Record_Model' in method 'testRecordModel'. Open
$recordModel = \Settings_Currency_Record_Model::getInstance(self::$id);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Settings_Currency_Record_Model' in method 'testRecordModel'. Open
$allNonmappedRecords = \Settings_Currency_Record_Model::getAllNonMapped();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Settings_Currency_Module_Model' in method 'testDeleteCurrency'. Open
\Settings_Currency_Module_Model::delete(self::$id);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Settings_Currency_ListView_Model' in method 'testListViewModel'. Open
$model = \Settings_Currency_ListView_Model::getInstance('Settings:Currency');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Settings_Currency_Record_Model' in method 'testRecordModel'. Open
$this->assertNotNull(\Settings_Currency_Record_Model::getInstance($recordModel->getName()), 'Expected record model instance.');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Settings_Currency_Record_Model' in method 'testRecordModel'. Open
$allRecords = \Settings_Currency_Record_Model::getAll();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Settings_Currency_Record_Model' in method 'testEditCurrency'. Open
$recordModel = \Settings_Currency_Record_Model::getInstance(self::$id);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Define a constant instead of duplicating this literal "deleted" 3 times. Open
$this->assertTrue($testRecord->has('deleted'), 'Instance should contain field `deleted`');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "currency_code" 6 times. Open
$recordModel->set('currency_code', 'BHD');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "currency_name" 7 times. Open
$recordModel->set('currency_name', 'Bahrain');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "currency_status" 5 times. Open
$recordModel->set('currency_status', 'Active');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "currency_symbol" 6 times. Open
$recordModel->set('currency_symbol', 'BD');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "vtiger_currency_info" 4 times. Open
$row = (new \App\Db\Query())->from('vtiger_currency_info')->where(['id' => self::$id])->one();
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "conversion_rate" 5 times. Open
$recordModel->set('conversion_rate', 1.65);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "Argentina" 3 times. Open
$recordModel->set('currency_name', 'Argentina');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Call to undeclared method \Tests\Settings\Currency::assertSame
Open
$this->assertSame($row['currency_symbol'], '$');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertIsArray
Open
$this->assertIsArray($allRecords, 'Expected that all records result is always array type');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertTrue
Open
$this->assertTrue($testRecord->has('currency_symbol'), 'Instance should contain field `currency_symbol`');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertInstanceOf
Open
$this->assertInstanceOf('Settings_Currency_Record_Model', $testNonmappedRecord, 'Instance type mismatch');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertTrue
Open
$this->assertTrue($testNonmappedRecord->has('currency_name'), 'Instance should contain field `currency_name`');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertNotEmpty
Open
$this->assertNotEmpty($recordModel->getName(), 'Expected name is not empty');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertTrue
Open
$this->assertTrue($testRecord->has('id'), 'Instance should contain field `id`');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertIsArray
Open
$this->assertIsArray($allNonmappedRecords, 'Expected that all non mapped records result is always array type');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertSame
Open
$this->assertSame($row['currency_code'], 'ARS');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertFalse
Open
$this->assertFalse($recordModel->isBaseCurrency(), 'Expected that record is not base currency');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertNotEmpty
Open
$this->assertNotEmpty($allRecords, 'Expected that all records result is not empty');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertNotNull
Open
$this->assertNotNull(self::$id, 'Id is null');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertSame
Open
$this->assertSame($row['currency_status'], 'No');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertNotNull
Open
$this->assertNotNull(\Settings_Currency_Record_Model::getInstance($recordModel->getName()), 'Expected record model instance.');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertTrue
Open
$this->assertTrue($testRecord->has('defaultid'), 'Instance should contain field `defaultid`');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertTrue
Open
$this->assertTrue($testNonmappedRecord->has('currency_code'), 'Instance should contain field `currency_code`');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertNotFalse
Open
$this->assertNotFalse($row, 'No record id: ' . self::$id);
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertSame
Open
$this->assertSame($row['currency_code'], 'BHD');
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$row = (new \App\Db\Query())->from('vtiger_currency_info')->where(['id' => self::$id])->one();
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertTrue
Open
$this->assertTrue((new \App\Db\Query())->from('vtiger_currency_info')->where(['and', ['currency_name' => 'Argentina', 'deleted' => 1]])->exists());
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertSame
Open
$this->assertSame((float) $row['conversion_rate'], 1.65);
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertInstanceOf
Open
$this->assertInstanceOf('\App\Db\Query', $basicListQuery, 'Query object expected.');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertSame
Open
$this->assertSame($row['currency_symbol'], 'BD');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertNotNull
Open
$this->assertNotNull($recordModel, 'Expected recordModel is not empty');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertNotEmpty
Open
$this->assertNotEmpty($allNonmappedRecords, 'Expected that all non mapped records result is not empty');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertTrue
Open
$this->assertTrue($testNonmappedRecord->has('currencyid'), 'Instance should contain field `currencyid`');
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$this->assertTrue((new \App\Db\Query())->from('vtiger_currency_info')->where(['and', ['id' => self::$id, 'deleted' => 1]])->exists());
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertTrue
Open
$this->assertTrue($testRecord->has('currency_code'), 'Instance should contain field `currency_code`');
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$row = (new \App\Db\Query())->from('vtiger_currency_info')->where(['id' => self::$id])->one();
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertSame
Open
$this->assertSame($row['currency_name'], 'Bahrain');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertNotEmpty
Open
$this->assertNotEmpty($basicListQuery->createCommand()->execute(), 'Query execute should return any result');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertTrue
Open
$this->assertTrue($testRecord->has('conversion_rate'), 'Instance should contain field `conversion_rate`');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertTrue
Open
$this->assertTrue($testNonmappedRecord->has('currency_symbol'), 'Instance should contain field `currency_symbol`');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertTrue
Open
$this->assertTrue((new \App\Db\Query())->from('vtiger_currency_info')->where(['and', ['id' => self::$id, 'deleted' => 1]])->exists());
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertInstanceOf
Open
$this->assertInstanceOf('Settings_Currency_Record_Model', $testRecord, 'Instance type mismatch');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertSame
Open
$this->assertSame($row['currency_status'], 'Active');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertSame
Open
$this->assertSame($row['currency_name'], 'Argentina');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertIsArray
Open
$this->assertIsArray($recordModel->getRecordLinks(), 'Expected that record links is always array type');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertNotFalse
Open
$this->assertNotFalse($row, 'No record id: ' . self::$id);
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertTrue
Open
$this->assertTrue($testRecord->has('currency_name'), 'Instance should contain field `currency_name`');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertTrue
Open
$this->assertTrue($testRecord->has('currency_status'), 'Instance should contain field `currency_status`');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertSame
Open
$this->assertSame((float) $row['conversion_rate'], 0.65);
- Exclude checks
Call to undeclared method \App\Db\Command::execute
Open
$this->assertNotEmpty($basicListQuery->createCommand()->execute(), 'Query execute should return any result');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertSame
Open
$this->assertSame($recordModel->getDeleteStatus(), 0, 'Expected that delete status of record is 0');
- Exclude checks
Call to undeclared method \Tests\Settings\Currency::assertTrue
Open
$this->assertTrue($testRecord->has('deleted'), 'Instance should contain field `deleted`');
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$this->assertTrue((new \App\Db\Query())->from('vtiger_currency_info')->where(['and', ['currency_name' => 'Argentina', 'deleted' => 1]])->exists());
- Exclude checks
Avoid variables with short names like $id. Configured minimum length is 3. Open
private static $id;
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Spaces must be used for alignment; tabs are not allowed Open
private static $id;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* Currency id.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* Testing add currency creation.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function testAddCurrency()
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function testListViewModel()
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$recordModel->set('conversion_rate', 1.65);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$recordModel->set('currency_symbol', '$');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertNotNull($recordModel, 'Expected recordModel is not empty');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertIsArray($allRecords, 'Expected that all records result is always array type');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertNotEmpty($allRecords, 'Expected that all records result is not empty');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertTrue($testRecord->has('currency_symbol'), 'Instance should contain field `currency_symbol`');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertSame($row['currency_name'], 'Bahrain');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertSame($row['currency_symbol'], 'BD');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertSame($row['currency_name'], 'Argentina');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($testRecord) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertInstanceOf('Settings_Currency_Record_Model', $testRecord, 'Instance type mismatch');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @author Radosław Skrzypczak <r.skrzypczak@yetiforce.com>
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
self::$id = $recordModel->save();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* Testing ListView model functions.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$testRecord = \array_pop($allRecords);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->logs = $testRecord;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertTrue($testRecord->has('currency_name'), 'Instance should contain field `currency_name`');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertTrue($testRecord->has('deleted'), 'Instance should contain field `deleted`');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertIsArray($allNonmappedRecords, 'Expected that all non mapped records result is always array type');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertSame((float) $row['conversion_rate'], 0.65);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertNotEmpty($basicListQuery->createCommand()->execute(), 'Query execute should return any result');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertFalse($recordModel->isBaseCurrency(), 'Expected that record is not base currency');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertTrue($testRecord->has('defaultid'), 'Instance should contain field `defaultid`');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* Testing edit currency creation.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$row = (new \App\Db\Query())->from('vtiger_currency_info')->where(['id' => self::$id])->one();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function testDeleteCurrency()
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertSame($row['currency_code'], 'BHD');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertNotEmpty($recordModel->getName(), 'Expected name is not empty');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertTrue($testRecord->has('currency_code'), 'Instance should contain field `currency_code`');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertTrue($testNonmappedRecord->has('currencyid'), 'Instance should contain field `currencyid`');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$recordModel->set('currency_status', 'Active');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$recordModel->set('currency_code', 'BHD');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertNotFalse($row, 'No record id: ' . self::$id);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$recordModel->set('currency_status', 'No');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertSame($row['currency_symbol'], '$');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function testRecordModel()
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertNotNull(\Settings_Currency_Record_Model::getInstance($recordModel->getName()), 'Expected record model instance.');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertTrue($testRecord->has('conversion_rate'), 'Instance should contain field `conversion_rate`');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertInstanceOf('Settings_Currency_Record_Model', $testNonmappedRecord, 'Instance type mismatch');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$allNonmappedRecords = \Settings_Currency_Record_Model::getAllNonMapped();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertTrue($testNonmappedRecord->has('currency_symbol'), 'Instance should contain field `currency_symbol`');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertSame($row['currency_status'], 'Active');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->logs = $row;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertSame($row['currency_status'], 'No');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$basicListQuery = $model->getBasicListQuery();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertTrue($testNonmappedRecord->has('currency_code'), 'Instance should contain field `currency_code`');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertNotNull(self::$id, 'Id is null');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$row = (new \App\Db\Query())->from('vtiger_currency_info')->where(['id' => self::$id])->one();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->logs = $row;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$recordModel->set('conversion_rate', 0.65);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$recordModel->set('currency_code', 'ARS');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertTrue($testRecord->has('currency_status'), 'Instance should contain field `currency_status`');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertTrue((new \App\Db\Query())->from('vtiger_currency_info')->where(['and', ['id' => self::$id, 'deleted' => 1]])->exists());
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$recordModel->set('currency_name', 'Bahrain');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function testEditCurrency()
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$recordModel->set('currency_symbol', 'BD');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertNotFalse($row, 'No record id: ' . self::$id);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
self::$id = $recordModel->save();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertIsArray($recordModel->getRecordLinks(), 'Expected that record links is always array type');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertSame($recordModel->getDeleteStatus(), 0, 'Expected that delete status of record is 0');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertNotEmpty($allNonmappedRecords, 'Expected that all non mapped records result is not empty');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($testNonmappedRecord) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
\Settings_Currency_Module_Model::delete(self::$id);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$recordModel = new \Settings_Currency_Record_Model();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertSame($row['currency_code'], 'ARS');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertInstanceOf('\App\Db\Query', $basicListQuery, 'Query object expected.');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$allRecords = \Settings_Currency_Record_Model::getAll();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertTrue($testRecord->has('id'), 'Instance should contain field `id`');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->logs = $testNonmappedRecord;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertTrue((new \App\Db\Query())->from('vtiger_currency_info')->where(['and', ['currency_name' => 'Argentina', 'deleted' => 1]])->exists());
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertSame((float) $row['conversion_rate'], 1.65);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$recordModel = \Settings_Currency_Record_Model::getInstance(self::$id);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$recordModel->set('currency_name', 'Argentina');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$model = \Settings_Currency_ListView_Model::getInstance('Settings:Currency');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* Testing Record model functions.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$recordModel = \Settings_Currency_Record_Model::getInstance(self::$id);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$testNonmappedRecord = \array_pop($allNonmappedRecords);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->assertTrue($testNonmappedRecord->has('currency_name'), 'Instance should contain field `currency_name`');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* Testing deletet currency creation.
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
$this->assertTrue((new \App\Db\Query())->from('vtiger_currency_info')->where(['and', ['id' => self::$id, 'deleted' => 1]])->exists());
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
$this->assertNotNull(\Settings_Currency_Record_Model::getInstance($recordModel->getName()), 'Expected record model instance.');
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
$this->assertTrue($testNonmappedRecord->has('currency_name'), 'Instance should contain field `currency_name`');
- Exclude checks
Line exceeds 120 characters; contains 155 characters Open
$this->assertTrue((new \App\Db\Query())->from('vtiger_currency_info')->where(['and', ['currency_name' => 'Argentina', 'deleted' => 1]])->exists());
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
$this->assertTrue($testNonmappedRecord->has('currency_symbol'), 'Instance should contain field `currency_symbol`');
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
$this->assertTrue($testNonmappedRecord->has('currency_code'), 'Instance should contain field `currency_code`');
- Exclude checks