File Z_ResetingRecordNumber.php
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Reseting record number test class.
*
* @package Tests
Method testLeadingZeros
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testLeadingZeros(): void
{
for ($leadingZeros = 0; $leadingZeros < 7; ++$leadingZeros) {
$actualNumber = 1;
$prefix = '{{YYYY}}-{{MM}}-{{DD}}/';
Method testIncrementNumberMonth
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testIncrementNumberMonth(): void
{
$actualNumber = 1;
$prefix = '{{YYYY}}-{{MM}}-{{DD}}/';
$postfix = '';
Method testIncrementNumberYear
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testIncrementNumberYear(): void
{
$actualNumber = 1;
$prefix = '{{YYYY}}-{{MM}}-{{DD}}/';
$postfix = '';
Method testIncrementNumberDay
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testIncrementNumberDay()
{
$parts = explode('-', RecordNumber::$dates[0]);
$actualNumber = 1;
$prefix = '{{YYYY}}-{{MM}}-{{DD}}/';
Function testLeadingZeros
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function testLeadingZeros(): void
{
for ($leadingZeros = 0; $leadingZeros < 7; ++$leadingZeros) {
$actualNumber = 1;
$prefix = '{{YYYY}}-{{MM}}-{{DD}}/';
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid using undefined variables such as '$dates' which will lead to PHP notices. Open
RecordNumber::$dates[0] = date('Y-m-d');
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Missing class import via use statement (line '208', column '23'). Open
$originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->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 '258', column '23'). Open
$originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->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 '159', column '23'). Open
$originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->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 '309', column '24'). Open
$originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->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 '101', column '23'). Open
$originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => \App\Module::getModuleId('FInvoice')])->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 'Tests\Base\RecordNumber' in method 'testSequenceNumber'. Open
$this->assertSame($parts[0], RecordNumber::getSequenceNumber('Y'));
- 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 'Tests\Base\RecordNumber' in method 'testIncrementNumberMonth'. Open
$instance = RecordNumber::getInstance('FInvoice');
- 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 'Tests\Base\RecordNumber' in method 'testSequenceNumber'. Open
$this->assertSame($parts[0] . $parts[1], RecordNumber::getSequenceNumber('M'));
- 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 'Tests\Base\RecordNumber' in method 'testIncrementNumberDay'. Open
$number = RecordNumber::getInstance('FInvoice');
- 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 testLeadingZeros uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$currentNumber = 1;
$currentDate = $sequence;
}
- 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 'Tests\Base\RecordNumber' in method 'testSequenceNumber'. Open
$this->assertSame($parts[0] . $parts[1] . $parts[2], RecordNumber::getSequenceNumber('D'));
- 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 'Tests\Base\RecordNumber' in method 'testParse'. Open
$instance = RecordNumber::getInstance('FInvoice');
- 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 'Tests\Base\RecordNumber' in method 'testIncrementNumberMonth'. Open
$number = RecordNumber::getInstance('FInvoice');
- 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 '\App\Module' in method 'testIncrementNumberStandard'. Open
$originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => \App\Module::getModuleId('FInvoice')])->one();
- 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 'Tests\Base\RecordNumber' in method 'testIncrementNumberDay'. Open
$instance = RecordNumber::getInstance('FInvoice');
- 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 '\App\Cache' in method 'tearDownAfterClass'. Open
\App\Cache::clear();
- 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 testIncrementNumberMonth uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$currentNumber = 1;
$currentDate = $sequence;
}
- 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 'Tests\Base\RecordNumber' in method 'testIncrementNumberYear'. Open
$number = RecordNumber::getInstance('FInvoice');
- 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 'Tests\Base\RecordNumber' in method 'testLeadingZeros'. Open
$number = RecordNumber::getInstance('FInvoice');
- 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 'Tests\Base\RecordNumber' in method 'testIncrementNumberYear'. Open
$instance = RecordNumber::getInstance('FInvoice');
- 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 testIncrementNumberYear uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$currentNumber = 1;
$currentDate = $sequence;
}
- 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
The method testIncrementNumberDay uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$currentNumber = 1;
$currentDate = $sequence;
}
- 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 'Tests\Base\RecordNumber' in method 'testIncrementNumberStandard'. Open
$number = RecordNumber::getInstance('FInvoice');
- 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 'Tests\Base\RecordNumber' in method 'testDateMock'. Open
$this->assertSame($date, RecordNumber::date('Y-m-d'));
- 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 'Tests\Base\RecordNumber' in method 'testLeadingZeros'. Open
$instance = RecordNumber::getInstance('FInvoice');
- 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 "cur_sequence" 14 times. Open
$this->assertSame('', $originalRow['cur_sequence']);
- 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_modentity_num" 5 times. Open
$originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => \App\Module::getModuleId('FInvoice')])->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 "postfix" 14 times. Open
$this->assertSame('', $originalRow['postfix']);
- 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 "reset_sequence" 14 times. Open
$this->assertSame(null, $originalRow['reset_sequence']);
- 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 "{{YYYY}}-{{MM}}-{{DD}}/" 4 times. Open
$prefix = '{{YYYY}}-{{MM}}-{{DD}}/';
- 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 "leading_zeros" 12 times. Open
$instance->set('leading_zeros', 0);
- 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 "prefix" 18 times. Open
$instance = RecordNumber::getInstance('FInvoice')->set('prefix', 'F-I')->set('cur_id', 1);
- 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 "cur_id" 15 times. Open
$instance = RecordNumber::getInstance('FInvoice')->set('prefix', 'F-I')->set('cur_id', 1);
- 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 "FInvoice" 12 times. Open
$instance = RecordNumber::getInstance('FInvoice')->set('prefix', 'F-I')->set('cur_id', 1);
- 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 "tabid" 5 times. Open
$originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => \App\Module::getModuleId('FInvoice')])->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.
Avoid unused local variables such as '$date'. Open
foreach (RecordNumber::$dates as $index => $date) {
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid unused parameters such as '$time'. Open
public static function date($format, $time = null)
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused local variables such as '$index'. Open
foreach (RecordNumber::$dates as $index => $date) {
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Static call to undeclared method \Tests\Base\RecordNumber::getInstance
Open
$instance = RecordNumber::getInstance('FInvoice');
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame(0, $originalRow['leading_zeros']);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame(0, $number->get('leading_zeros'));
- Exclude checks
Static call to undeclared method \Tests\Base\RecordNumber::getInstance
Open
$instance = RecordNumber::getInstance('FInvoice');
- Exclude checks
Static call to undeclared method \Tests\Base\RecordNumber::getInstance
Open
$instance = RecordNumber::getInstance('FInvoice');
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($parts[0], RecordNumber::getSequenceNumber('Y'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($curSequence, $originalRow['cur_sequence']);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($actualNumber, $originalRow['cur_id']);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($actualNumber, $number->get('cur_id'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame(null, $number->get('reset_sequence'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame(1, $result);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame(0, $originalRow['leading_zeros']);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($postfix, $originalRow['postfix']);
- Exclude checks
Static call to undeclared method \Tests\Base\RecordNumber::getInstance
Open
$number = RecordNumber::getInstance('FInvoice');
- Exclude checks
Static call to undeclared method \Tests\Base\RecordNumber::getInstance
Open
$instance = RecordNumber::getInstance('FInvoice')->set('prefix', 'F-I')->set('cur_id', 1);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->one();
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($resetSequence, $originalRow['reset_sequence']);
- Exclude checks
Static call to undeclared method \Tests\Base\RecordNumber::getInstance
Open
$number = RecordNumber::getInstance('FInvoice');
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($prefix, $number->get('prefix'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($resetSequence, $number->get('reset_sequence'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($postfix, $originalRow['postfix']);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => \App\Module::getModuleId('FInvoice')])->one();
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($parts[1] . '/1', $instance->parseNumber(1));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame("$date/$currentNumber", $instance->getIncrementNumber());
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame(1, $result);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($curSequence, $originalRow['cur_sequence']);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($currentNumber + 1, $number->get('cur_id'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame('F-I', $originalRow['prefix']);
- Exclude checks
Static call to undeclared method \Tests\Base\RecordNumber::getInstance
Open
$instance = RecordNumber::getInstance('FInvoice');
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($prefix, $originalRow['prefix']);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($resetSequence, $number->get('reset_sequence'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($curSequence, $originalRow['cur_sequence']);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($sequence, $number->get('cur_sequence'));
- Exclude checks
Static call to undeclared method \Tests\Base\RecordNumber::getSequenceNumber
Open
$this->assertSame($parts[0] . $parts[1] . $parts[2], RecordNumber::getSequenceNumber('D'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame('', $originalRow['postfix']);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame("F-I$actualNumber", $instance->getIncrementNumber());
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame('', $number->get('cur_sequence'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($postfix, $number->get('postfix'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($actualNumber, $originalRow['cur_id']);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($leadingZeros, $originalRow['leading_zeros']);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame(1, $result);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($postfix, $originalRow['postfix']);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($postfix, $originalRow['postfix']);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($prefix, $number->get('prefix'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($postfix, $number->get('postfix'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($prefix, $number->get('prefix'));
- Exclude checks
Class extends undeclared class \App\Fields\RecordNumber
(Did you mean class \Tests\Base\RecordNumber) Open
class RecordNumber extends \App\Fields\RecordNumber
- Exclude checks
Static call to undeclared method \Tests\Base\RecordNumber::getSequenceNumber
Open
$this->assertSame($parts[0], RecordNumber::getSequenceNumber('Y'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($parts[2] . '/1', $instance->parseNumber(1));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame(0, $originalRow['leading_zeros']);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($prefix, $originalRow['prefix']);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($currentNumber + 1, $number->get('cur_id'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($resetSequence, $originalRow['reset_sequence']);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame("$date/$currentNumber", $instance->getIncrementNumber());
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame(1, $result);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->one();
- Exclude checks
Argument 1 (input)
is 1
but \str_pad()
takes string
Open
$currentNumber = \str_pad($currentNumber, $leadingZeros, '0', STR_PAD_LEFT);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame('', $originalRow['cur_sequence']);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($parts[0] . '/1', $instance->parseNumber(1));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($sequence, $number->get('cur_sequence'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($postfix, $number->get('postfix'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame(0, $number->get('leading_zeros'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($curSequence, $originalRow['cur_sequence']);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($parts[0] . $parts[1] . $parts[2], RecordNumber::getSequenceNumber('D'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame('F-I', $number->get('prefix'));
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->one();
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($actualNumber, $originalRow['cur_id']);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->one();
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($resetSequence, $originalRow['reset_sequence']);
- Exclude checks
Static call to undeclared method \Tests\Base\RecordNumber::getInstance
Open
$number = RecordNumber::getInstance('FInvoice');
- Exclude checks
Call to method rollBack
from undeclared class \yii\db\Transaction
Open
self::$transaction->rollBack();
- Exclude checks
Property \Tests\Base\Z_ResetingRecordNumber::$transaction
has undeclared type \yii\db\Transaction
Open
private static $transaction;
- Exclude checks
Call to undeclared method \App\Db::beginTransaction
Open
self::$transaction = \App\Db::getInstance()->beginTransaction();
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame('', $number->get('postfix'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($prefix, $originalRow['prefix']);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($postfix, $number->get('postfix'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($date, RecordNumber::date('Y-m-d'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($parts[0] . $parts[1], RecordNumber::getSequenceNumber('M'));
- Exclude checks
Static call to undeclared method \Tests\Base\RecordNumber::getInstance
Open
$number = RecordNumber::getInstance('FInvoice');
- Exclude checks
Static call to undeclared method \Tests\Base\RecordNumber::getInstance
Open
$instance = RecordNumber::getInstance('FInvoice');
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($actualNumber, $originalRow['cur_id']);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($resetSequence, $originalRow['reset_sequence']);
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($currentNumber + 1, $number->get('cur_id'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($resetSequence, $number->get('reset_sequence'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($prefix, $originalRow['prefix']);
- Exclude checks
Static call to undeclared method \Tests\Base\RecordNumber::getSequenceNumber
Open
$this->assertSame($parts[0] . $parts[1], RecordNumber::getSequenceNumber('M'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame("$date/$currentNumber", $instance->getIncrementNumber());
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($currentNumber + 1, $number->get('cur_id'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($sequence, $number->get('cur_sequence'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($prefix, $number->get('prefix'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($leadingZeros, $number->get('leading_zeros'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($resetSequence, $number->get('reset_sequence'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame(null, $originalRow['reset_sequence']);
- Exclude checks
Static call to undeclared method \Tests\Base\RecordNumber::getInstance
Open
$number = RecordNumber::getInstance('FInvoice');
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame(0, $number->get('leading_zeros'));
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame("$date/$currentNumber", $instance->getIncrementNumber());
- Exclude checks
Call to undeclared method \Tests\Base\Z_ResetingRecordNumber::assertSame
Open
$this->assertSame($sequence, $number->get('cur_sequence'));
- Exclude checks
The class Z_ResetingRecordNumber is not named in CamelCase. Open
class Z_ResetingRecordNumber extends \Tests\Base
{
/**
* Database transaction pointer.
*
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Each class must be in a file by itself Open
class Z_ResetingRecordNumber extends \Tests\Base
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $currentDateIndex = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return false|string
- 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
$instance->set('prefix', '{{YYYY}}/');
- 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
* @var \yii\db\Transaction
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parts = explode('-', RecordNumber::$dates[0]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$resetSequence = 'D';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Test method "DateMock".
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($actualNumber, $originalRow['cur_id']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($postfix, $originalRow['postfix']);
- 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
$sequence = $parts[0] . $parts[1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Test method "IncrementNumberStandard".
- 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
$curSequence = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testParse()
- 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 testIncrementNumberDay()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($sequence, $number->get('cur_sequence'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testIncrementNumberMonth(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('cur_sequence', $curSequence);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentNumber = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentDate = '';
- 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(1, $result);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('cur_id', $actualNumber);
- 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
* Setting of tests.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
RecordNumber::$currentDateIndex = $index;
- 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("F-I$actualNumber", $instance->getIncrementNumber());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame('F-I', $number->get('prefix'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($parts[0] . '/1', $instance->parseNumber(1));
- 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
* Test method "IncrementNumberMonth".
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($actualNumber, $originalRow['cur_id']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
RecordNumber::$currentDateIndex = $index;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$currentNumber;
- 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($curSequence, $originalRow['cur_sequence']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parts = explode('-', $date);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentDate = $sequence;
- 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 testLeadingZeros(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame(null, $originalRow['reset_sequence']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame('', $number->get('cur_sequence'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($currentNumber + 1, $number->get('cur_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
if ($sequence === $currentDate) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($resetSequence, $originalRow['reset_sequence']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (RecordNumber::$dates as $index => $date) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($sequence === $currentDate) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($currentNumber + 1, $number->get('cur_id'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($postfix, $number->get('postfix'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('reset_sequence', $resetSequence);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($leadingZeros, $originalRow['leading_zeros']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($actualNumber, $originalRow['cur_id']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
RecordNumber::$currentDateIndex = $index;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $format
- 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
foreach (RecordNumber::$dates as $index => $date) {
- 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
$parts = explode('-', $date);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$postfix = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$curSequence = ($parts[0] . $parts[1] . $parts[2]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame(0, $originalRow['leading_zeros']);
- 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
$originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = $instance->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$currentNumber;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($resetSequence, $number->get('reset_sequence'));
- 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
* Test leading zeros in numbers generation.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($prefix, $number->get('prefix'));
- 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
* Database transaction pointer.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array of dates
- 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
RecordNumber::$currentDateIndex = $index;
- 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
foreach (RecordNumber::$dates as $index => $date) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actualNumber = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($parts[2] . '/1', $instance->parseNumber(1));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$prefix = '{{YYYY}}-{{MM}}-{{DD}}/';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actualNumber = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('leading_zeros', 0);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('reset_sequence', $resetSequence);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = $instance->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentNumber = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($resetSequence, $originalRow['reset_sequence']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($postfix, $number->get('postfix'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame("$date/$currentNumber", $instance->getIncrementNumber());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Test method "IncrementNumberYear".
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentNumber = 1;
- 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
$instance->set('leading_zeros', 0);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$number = RecordNumber::getInstance('FInvoice');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentDate = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$resetSequence = 'Y';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentNumber = 1;
- 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
if ($sequence === $currentDate) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::clear();
- 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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $dates = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$currentDateIndex = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return date($format, strtotime(self::$dates[self::$currentDateIndex]));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testDateMock()
- 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 testSequenceNumber()
- 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 140 characters Open
$originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => \App\Module::getModuleId('FInvoice')])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame('', $originalRow['cur_sequence']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance = RecordNumber::getInstance('FInvoice');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('prefix', '{{MM}}/');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Test method "IncrementNumberDay".
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Test record number resetting with new day.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('prefix', $prefix);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('reset_sequence', $resetSequence);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('cur_sequence', $curSequence);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sequence = str_replace('-', '', $date);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentDate = $sequence;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Test record number resetting with new month.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$curSequence = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentNumber = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Test method "LeadingZeros"
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actualNumber = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentNumber = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$currentNumber;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentNumber = \str_pad($currentNumber, $leadingZeros, '0', STR_PAD_LEFT);
- 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::$transaction->rollBack();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('leading_zeros', $leadingZeros);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentDate = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentDate = $sequence;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sequence = $parts[0];
- 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
$instance->set('cur_sequence', $curSequence);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($postfix, $originalRow['postfix']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (RecordNumber::$dates as $index => $date) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame("$date/$currentNumber", $instance->getIncrementNumber());
- 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
'2015-01-01'
- 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 static function date($format, $time = 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
RecordNumber::$dates[0] = date('Y-m-d');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($parts[0] . $parts[1], RecordNumber::getSequenceNumber('M'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testIncrementNumberStandard()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => \App\Module::getModuleId('FInvoice')])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame('F-I', $originalRow['prefix']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($actualNumber, $number->get('cur_id'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame(null, $number->get('reset_sequence'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('prefix', '{{DD}}/');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (RecordNumber::$dates as $index => $date) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$postfix = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('prefix', $prefix);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parts = explode('-', $date);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$number = RecordNumber::getInstance('FInvoice');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$postfix = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('postfix', $postfix);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($prefix, $originalRow['prefix']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame(0, $originalRow['leading_zeros']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($actualNumber, $originalRow['cur_id']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame(0, $number->get('leading_zeros'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance = RecordNumber::getInstance('FInvoice');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('postfix', $postfix);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($currentNumber + 1, $number->get('cur_id'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($postfix, $number->get('postfix'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $transaction;
- 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
foreach (RecordNumber::$dates as $index => $date) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = $instance->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$currentNumber;
- 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($currentNumber + 1, $number->get('cur_id'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($postfix, $number->get('postfix'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$curSequence = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame("$date/$currentNumber", $instance->getIncrementNumber());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$prefix = '{{YYYY}}-{{MM}}-{{DD}}/';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$postfix = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('prefix', $prefix);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($curSequence, $originalRow['cur_sequence']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parts = explode('-', $date);
- 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
foreach (RecordNumber::$dates as $index => $date) {
- 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
$instance = RecordNumber::getInstance('FInvoice');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$number = RecordNumber::getInstance('FInvoice');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame(0, $number->get('leading_zeros'));
- 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
$resetSequence = 'M';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentDate = $sequence;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Test record number resetting with new year.
- 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($resetSequence, $originalRow['reset_sequence']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($resetSequence, $number->get('reset_sequence'));
- 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::$transaction = \App\Db::getInstance()->beginTransaction();
- 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
$parts = explode('-', $date);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($parts[0] . $parts[1] . $parts[2], RecordNumber::getSequenceNumber('D'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actualNumber = $originalRow['cur_id'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$actualNumber;
- 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($prefix, $originalRow['prefix']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($postfix, $originalRow['postfix']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
RecordNumber::$currentDateIndex = $index;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($prefix, $number->get('prefix'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$prefix = '{{YYYY}}-{{MM}}-{{DD}}/';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('postfix', $postfix);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('leading_zeros', 0);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($prefix, $originalRow['prefix']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame(0, $originalRow['leading_zeros']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($prefix, $number->get('prefix'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testIncrementNumberYear(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('prefix', $prefix);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = $instance->save();
- 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($leadingZeros, $number->get('leading_zeros'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function tearDownAfterClass(): void
- 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|null $time
- 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
* @codeCoverageIgnore
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame('', $number->get('postfix'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$originalRow = (new \App\Db\Query())->from('vtiger_modentity_num')->where(['tabid' => 95])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($curSequence, $originalRow['cur_sequence']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame(1, $result);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (RecordNumber::$dates as $index => $date) {
- 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
$this->assertSame($sequence, $number->get('cur_sequence'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('cur_id', $actualNumber);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('cur_sequence', $curSequence);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sequence = $parts[0];
- 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
$currentNumber = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($sequence, $number->get('cur_sequence'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Cleaning after tests.
- 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
* Date method mock for testing purposes.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($date, RecordNumber::date('Y-m-d'));
- 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
$instance = RecordNumber::getInstance('FInvoice')->set('prefix', 'F-I')->set('cur_id', 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame('', $originalRow['postfix']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($parts[1] . '/1', $instance->parseNumber(1));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('cur_id', $actualNumber);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame(1, $result);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentDate = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentNumber = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame("$date/$currentNumber", $instance->getIncrementNumber());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($resetSequence, $number->get('reset_sequence'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($curSequence, $originalRow['cur_sequence']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame(0, $number->get('leading_zeros'));
- 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
$resetSequence = 'Y';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
for ($leadingZeros = 0; $leadingZeros < 7; ++$leadingZeros) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame(1, $result);
- 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
* Test method "StandardNumber".
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($parts[0], RecordNumber::getSequenceNumber('Y'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$number = RecordNumber::getInstance('FInvoice');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Test method "Parse".
- 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
if ($sequence === $currentDate) {
- 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
$instance->set('cur_id', $actualNumber);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($resetSequence, $number->get('reset_sequence'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$prefix = '{{YYYY}}-{{MM}}-{{DD}}/';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance = RecordNumber::getInstance('FInvoice');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('reset_sequence', $resetSequence);
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($prefix, $originalRow['prefix']);
- 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
if (!isset(self::$dates[self::$currentDateIndex])) {
- 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 static function setUpBeforeClass(): void
- 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
* Test parsing method for record numbers on different dates.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
RecordNumber::$currentDateIndex = $index;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->set('postfix', $postfix);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($resetSequence, $originalRow['reset_sequence']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance = RecordNumber::getInstance('FInvoice');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actualNumber = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($postfix, $originalRow['postfix']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
RecordNumber::$currentDateIndex = $index;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($sequence, $number->get('cur_sequence'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($prefix, $number->get('prefix'));
- 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
$number = RecordNumber::getInstance('FInvoice');
- Exclude checks
Class name "Z_ResetingRecordNumber" is not in camel caps format Open
class Z_ResetingRecordNumber extends \Tests\Base
- Exclude checks