Method save
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private function save($id, $type, $name, $value, $status, $default = false)
Missing class import via use statement (line '57', column '23'). Open
$recordModel = new \Settings_Inventory_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 '160', column '27'). Open
$this->assertFalse((new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- 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 '90', column '15'). Open
$row = (new \App\Db\Query())->from($tableName)->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 '195', column '15'). Open
$row = (new \App\Db\Query())->from($tableName)->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
The method save has a boolean flag argument $default, which is a certain sign of a Single Responsibility Principle violation. Open
private function save($id, $type, $name, $value, $status, $default = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '143', column '15'). Open
$row = (new \App\Db\Query())->from($tableName)->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 '34', column '15'). Open
$row = (new \App\Db\Query())->from($tableName)->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 '124', column '15'). Open
$row = (new \App\Db\Query())->from($tableName)->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 '212', column '27'). Open
$this->assertFalse((new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- 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 '176', column '15'). Open
$row = (new \App\Db\Query())->from($tableName)->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 '108', column '27'). Open
$this->assertFalse((new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- 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_Inventory_Record_Model' in method 'testDeleteCreditLimits'. Open
$recordModel = \Settings_Inventory_Record_Model::getInstanceById(self::$id, $type);
- 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_Inventory_Record_Model' in method 'testDeleteCreditLimits'. Open
$tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
- 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_Inventory_Record_Model' in method 'testAddDiscount'. Open
$tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
- 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_Inventory_Record_Model' in method 'testEditDiscount'. Open
$tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
- 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_Inventory_Record_Model' in method 'testEditCreditLimits'. Open
$tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
- 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_Inventory_Record_Model' in method 'testDeleteTaxes'. Open
$recordModel = \Settings_Inventory_Record_Model::getInstanceById(self::$id, $type);
- 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_Inventory_Record_Model' in method 'testDeleteDiscount'. Open
$tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
- 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
The method save uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$recordModel = \Settings_Inventory_Record_Model::getInstanceById($id, $type);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\Settings_Inventory_Record_Model' in method 'save'. Open
$recordModel = \Settings_Inventory_Record_Model::getInstanceById($id, $type);
- 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 '\CurrencyField' in method 'save'. Open
$recordModel->set('value', \CurrencyField::convertToDBFormat($recordModel->get('value')));
- 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_Inventory_Record_Model' in method 'testDeleteTaxes'. Open
$tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
- 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_Inventory_Record_Model' in method 'testEditTaxes'. Open
$tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
- 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_Inventory_Record_Model' in method 'testDeleteDiscount'. Open
$recordModel = \Settings_Inventory_Record_Model::getInstanceById(self::$id, $type);
- 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_Inventory_Record_Model' in method 'testAddCreditLimits'. Open
$tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
- 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_Inventory_Record_Model' in method 'testAddTaxes'. Open
$tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
- 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 "No record id: " 6 times. Open
$this->assertNotFalse($row, 'No record id: ' . self::$id);
- 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 "The record was not removed from the database ID: " 3 times. Open
$this->assertFalse((new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- 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 "CreditLimits" 3 times. Open
$type = 'CreditLimits';
- 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 "value" 9 times. Open
$this->assertSame((float) $row['value'], $value);
- 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 "Id is null" 3 times. Open
$this->assertNotNull(self::$id, 'Id is null');
- 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 "Taxes" 4 times. Open
$type = 'Taxes';
- 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 "test edit" 3 times. Open
$name = 'test edit';
- 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 "Discounts" 4 times. Open
if ('Discounts' === $type) {
- 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 "status" 7 times. Open
$this->assertSame((int) $row['status'], $status);
- 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 "default" 3 times. Open
$this->assertSame((int) $row['default'], $default);
- 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 \App\Db\Query::from
Open
$row = (new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->one();
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertFalse
Open
$this->assertFalse((new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertNotFalse
Open
$this->assertNotFalse($row, 'No record id: ' . self::$id);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$this->assertFalse((new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertSame
Open
$this->assertSame($row['name'], $name);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertSame
Open
$this->assertSame((int) $row['status'], $status);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertNotFalse
Open
$this->assertNotFalse($row, 'No record id: ' . self::$id);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertSame
Open
$this->assertSame((int) $row['status'], $status);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertSame
Open
$this->assertSame((int) $row['status'], $status);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertNotFalse
Open
$this->assertNotFalse($row, 'No record id: ' . self::$id);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertSame
Open
$this->assertSame((float) $row['value'], $value);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertNotFalse
Open
$this->assertNotFalse($row, 'No record id: ' . self::$id);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertSame
Open
$this->assertSame((float) $row['value'], $value);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$row = (new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->one();
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$row = (new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->one();
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertNotNull
Open
$this->assertNotNull(self::$id, 'Id is null');
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertNotFalse
Open
$this->assertNotFalse($row, 'No record id: ' . self::$id);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertSame
Open
$this->assertSame((int) $row['default'], $default);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertSame
Open
$this->assertSame($row['name'], $name);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertSame
Open
$this->assertSame($row['name'], $name);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertSame
Open
$this->assertSame((float) $row['value'], $value);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertSame
Open
$this->assertSame((int) $row['status'], $status);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$row = (new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->one();
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$row = (new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->one();
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertSame
Open
$this->assertSame((int) $row['status'], $status);
- Exclude checks
Argument 1 (id)
is ''
but \Tests\Settings\Inventory::save()
takes int
defined at /code/tests/Settings/Inventory.php:54
Open
self::$id = $this->save('', $type, $name, $value, $status);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertNotFalse
Open
$this->assertNotFalse($row, 'No record id: ' . self::$id);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$row = (new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->one();
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$this->assertFalse((new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$this->assertFalse((new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- Exclude checks
Argument 1 (id)
is ''
but \Tests\Settings\Inventory::save()
takes int
defined at /code/tests/Settings/Inventory.php:54
Open
self::$id = $this->save('', $type, $name, $value, $status);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertSame
Open
$this->assertSame((int) $row['value'], $value);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertSame
Open
$this->assertSame($row['name'], $name);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertSame
Open
$this->assertSame($row['name'], $name);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertSame
Open
$this->assertSame($row['name'], $name);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertFalse
Open
$this->assertFalse((new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertSame
Open
$this->assertSame((float) $row['value'], $value);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertFalse
Open
$this->assertFalse((new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertSame
Open
$this->assertSame((int) $row['status'], $status);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertNotNull
Open
$this->assertNotNull(self::$id, 'Id is null');
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertSame
Open
$this->assertSame((int) $row['default'], $default);
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertNotNull
Open
$this->assertNotNull(self::$id, 'Id is null');
- Exclude checks
Call to undeclared method \Tests\Settings\Inventory::assertSame
Open
$this->assertSame((int) $row['value'], $value);
- Exclude checks
Similar blocks of code found in 3 locations. Consider refactoring. Open
public function testDeleteCreditLimits()
{
$type = 'CreditLimits';
$recordModel = \Settings_Inventory_Record_Model::getInstanceById(self::$id, $type);
$recordModel->delete();
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 98.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
public function testDeleteTaxes()
{
$type = 'Taxes';
$recordModel = \Settings_Inventory_Record_Model::getInstanceById(self::$id, $type);
$recordModel->delete();
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 98.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
public function testDeleteDiscount()
{
$type = 'Discounts';
$recordModel = \Settings_Inventory_Record_Model::getInstanceById(self::$id, $type);
$recordModel->delete();
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 98.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Avoid variables with short names like $id. Configured minimum length is 3. Open
private function save($id, $type, $name, $value, $status, $default = false)
- 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
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 to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $status
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false !== $default && 'Taxes' === $type) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((float) $row['value'], $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $default
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('id', $id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($row['name'], $name);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = new \Settings_Inventory_Record_Model();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('value', $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $recordModel->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Inventory id.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$status = $default = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$type = 'Taxes';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = \Settings_Inventory_Record_Model::getInstanceById(self::$id, $type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing discount creation.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = 'test';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = \Settings_Inventory_Record_Model::getInstanceById($id, $type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('status', $status);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $id;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param float|int $value
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((float) $row['value'], $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testAddDiscount()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testAddTaxes()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $type
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing taxes edition.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$type = 'Taxes';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotFalse($row, 'No record id: ' . self::$id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$id = $this->save(0, $type, $name, $value, $status, $default);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotNull(self::$id, 'Id is null');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($row['name'], $name);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $id
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('value', \CurrencyField::convertToDBFormat($recordModel->get('value')));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = 'test edit';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->delete();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->setType($type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->save(self::$id, $type, $name, $value, $status, $default);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((int) $row['status'], $status);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((int) $row['default'], $default);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing taxes creation.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = 3.14;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($id)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = 1.16;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing taxes deletion.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testEditTaxes()
- Exclude checks
Line exceeds 120 characters; contains 171 characters Open
$this->assertFalse((new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$type = 'Taxes';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$status = $default = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = (new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((int) $row['default'], $default);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('name', $name);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testDeleteTaxes()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotFalse($row, 'No record id: ' . self::$id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Discounts' === $type) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('default', $default);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((int) $row['status'], $status);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Save to database.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function save($id, $type, $name, $value, $status, $default = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = (new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertFalse((new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$type = 'Discounts';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($row['name'], $name);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = 'test';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = 500;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($row['name'], $name);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing credit limits edition.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = 'test edit';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 171 characters Open
$this->assertFalse((new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testEditDiscount()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$type = 'CreditLimits';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = (new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((float) $row['value'], $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = 2.62;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = \Settings_Inventory_Record_Model::getInstanceById(self::$id, $type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = (new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((int) $row['value'], $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotFalse($row, 'No record id: ' . self::$id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->save(self::$id, $type, $name, $value, $status);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotFalse($row, 'No record id: ' . self::$id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->delete();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((int) $row['status'], $status);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotFalse($row, 'No record id: ' . self::$id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = (new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$status = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((float) $row['value'], $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotFalse($row, 'No record id: ' . self::$id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$type = 'Discounts';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = 'test edit';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($row['name'], $name);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$type = 'Discounts';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testEditCreditLimits()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((int) $row['status'], $status);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertFalse((new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- Exclude checks
Line exceeds 120 characters; contains 171 characters Open
$this->assertFalse((new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$id = $this->save('', $type, $name, $value, $status);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($row['name'], $name);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((int) $row['value'], $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing credit limits deletion.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testDeleteCreditLimits()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((int) $row['status'], $status);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing discount edition.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testDeleteDiscount()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing credit limits creation.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testAddCreditLimits()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotNull(self::$id, 'Id is null');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->save(self::$id, $type, $name, $value, $status);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$type = 'CreditLimits';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$status = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = \Settings_Inventory_Record_Model::getInstanceById(self::$id, $type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertFalse((new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$id = $this->save('', $type, $name, $value, $status);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotNull(self::$id, 'Id is null');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing discount deletion.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = 1410;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$status = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((int) $row['status'], $status);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = 'test name';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->delete();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$type = 'CreditLimits';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = 3.14;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = (new \App\Db\Query())->from($tableName)->where(['id' => self::$id])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableName = \Settings_Inventory_Record_Model::getTableNameFromType($type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$status = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks