-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5556 from codeigniter4/hotfix-4.1.7
Hotfix 4.1.7
- Loading branch information
Showing
22 changed files
with
279 additions
and
50 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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 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,61 @@ | ||
<?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\Debug\Toolbar\Collectors; | ||
|
||
use CodeIgniter\Database\Query; | ||
use CodeIgniter\Test\CIUnitTestCase; | ||
use PHPUnit\Framework\MockObject\MockObject; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
final class DatabaseTest extends CIUnitTestCase | ||
{ | ||
public function testDisplay(): void | ||
{ | ||
/** @var MockObject&Query $query */ | ||
$query = $this->getMockBuilder(Query::class) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
|
||
// set mock returns | ||
$query->method('getQuery')->willReturn('SHOW TABLES;'); | ||
$query->method('debugToolbarDisplay')->willReturn('<strong>SHOW</strong> TABLES;'); | ||
$query->method('getDuration')->with(5)->willReturn('1.23456'); | ||
|
||
Database::collect($query); // <== $query will be called here | ||
$collector = new Database(); | ||
|
||
$queries = $collector->display()['queries']; | ||
|
||
$this->assertSame('1234.56 ms', $queries[0]['duration']); | ||
$this->assertSame('<strong>SHOW</strong> TABLES;', $queries[0]['sql']); | ||
$this->assertSame(clean_path(__FILE__) . ':35', $queries[0]['trace-file']); | ||
|
||
foreach ($queries[0]['trace'] as $i => $trace) { | ||
// since we added the index numbering | ||
$this->assertArrayHasKey('index', $trace); | ||
$this->assertSame( | ||
sprintf('%s', $i + 1), | ||
preg_replace(sprintf('/%s/', chr(0xC2) . chr(0xA0)), '', $trace['index']) | ||
); | ||
|
||
// since we merged file & line together | ||
$this->assertArrayNotHasKey('line', $trace); | ||
$this->assertArrayHasKey('file', $trace); | ||
|
||
// since we dropped object & args in the backtrace for performance | ||
// but args MAY STILL BE present in internal calls | ||
$this->assertArrayNotHasKey('object', $trace); | ||
} | ||
} | ||
} |
This file contains 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 |
---|---|---|
|
@@ -12,6 +12,7 @@ See all the changes. | |
.. toctree:: | ||
:titlesonly: | ||
|
||
v4.1.7 | ||
v4.1.6 | ||
v4.1.5 | ||
v4.1.4 | ||
|
Oops, something went wrong.