-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: [Commands] lang:find
show bad keys when scanning (v2)
#8285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
33357b6
feat: Show bad lang keys when scanning
neznaika0 6610e32
test: Test bad lang keys when scanning
neznaika0 25a1573
fix: Show the keys and files where they are used
neznaika0 a166470
feat: Sort array values by natural order
neznaika0 e23c44c
test: Add duplicate data for example
neznaika0 fe3b430
test: Fix test for bad language keys
neznaika0 66d4f0e
test: Add for ArrayHelper::sortValuesByNatural
neznaika0 9747d12
docs: Add example output bad lang keys
neznaika0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
tests/system/Helpers/Array/ArrayHelperSortValuesByNaturalTest.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of CodeIgniter 4 framework. | ||
* | ||
* (c) CodeIgniter Foundation <admin@codeigniter.com> | ||
* | ||
* For the full copyright and license information, please view | ||
* the LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
namespace CodeIgniter\Helpers\Array; | ||
|
||
use CodeIgniter\Test\CIUnitTestCase; | ||
|
||
/** | ||
* @group Others | ||
* | ||
* @internal | ||
*/ | ||
final class ArrayHelperSortValuesByNaturalTest extends CIUnitTestCase | ||
{ | ||
private array $arrayWithStringValues = [ | ||
'apple10', | ||
'banana', | ||
'apple1', | ||
'банан', | ||
'Banana', | ||
'Apple', | ||
100000, | ||
'яблоко', | ||
1200, | ||
13000, | ||
'Банан', | ||
'Яблоко', | ||
'apple', | ||
]; | ||
private array $arrayWithArrayValues = [ | ||
['apple', 'Banana'], | ||
['apple10', 'Apple'], | ||
['Яблоко', 1200], | ||
[13000, 'Банан'], | ||
['Apple', 'apple1'], | ||
['banana', 'банан'], | ||
[100000, 13000], | ||
['Banana', 'Яблоко'], | ||
['Банан', 'banana'], | ||
[1200, 'apple'], | ||
['apple1', 'apple10'], | ||
['яблоко', 100000], | ||
['банан', 'яблоко'], | ||
]; | ||
|
||
public function testSortWithStringValues(): void | ||
{ | ||
shuffle($this->arrayWithStringValues); | ||
|
||
ArrayHelper::sortValuesByNatural($this->arrayWithStringValues); | ||
|
||
$this->assertSame([ | ||
1200, | ||
13000, | ||
100000, | ||
'Apple', | ||
'Banana', | ||
'apple', | ||
'apple1', | ||
'apple10', | ||
'banana', | ||
'Банан', | ||
'Яблоко', | ||
'банан', | ||
'яблоко', | ||
], $this->arrayWithStringValues); | ||
} | ||
|
||
public function testSortWithArrayValues(): void | ||
{ | ||
shuffle($this->arrayWithArrayValues); | ||
|
||
// For first index | ||
ArrayHelper::sortValuesByNatural($this->arrayWithArrayValues, 0); | ||
|
||
$this->assertSame([ | ||
[1200, 'apple'], | ||
[13000, 'Банан'], | ||
[100000, 13000], | ||
['Apple', 'apple1'], | ||
['Banana', 'Яблоко'], | ||
['apple', 'Banana'], | ||
['apple1', 'apple10'], | ||
['apple10', 'Apple'], | ||
['banana', 'банан'], | ||
['Банан', 'banana'], | ||
['Яблоко', 1200], | ||
['банан', 'яблоко'], | ||
['яблоко', 100000], | ||
], $this->arrayWithArrayValues); | ||
|
||
shuffle($this->arrayWithArrayValues); | ||
|
||
// For other index | ||
ArrayHelper::sortValuesByNatural($this->arrayWithArrayValues, 1); | ||
|
||
$this->assertSame([ | ||
['Яблоко', 1200], | ||
[100000, 13000], | ||
['яблоко', 100000], | ||
['apple10', 'Apple'], | ||
['apple', 'Banana'], | ||
[1200, 'apple'], | ||
['Apple', 'apple1'], | ||
['apple1', 'apple10'], | ||
['Банан', 'banana'], | ||
[13000, 'Банан'], | ||
['Banana', 'Яблоко'], | ||
['banana', 'банан'], | ||
['банан', 'яблоко'], | ||
], $this->arrayWithArrayValues); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is one feature: The regular expression initially discards bad keys. They will not be shown in the list.