30 Commits
Author SHA1 Message Date
Andrey Savchenko 9c7bd34d54 Released version 3.3.5 2021-09-28 11:19:21 +03:00
Andrey Savchenko a797c4f406 Adjusted tests for newer Brain Monkey compatibility 2021-09-28 11:16:09 +03:00
Andrey Savchenko a815ba515c Allowed PHP 8, composer/installers 2, and refreshed lock
Fixes #54
2021-09-28 11:14:51 +03:00
Andrey Savchenko 595b696a03 Reduced maximum Server Timing headers size for nginx
See #52
2021-09-28 11:05:51 +03:00
Andrey Savchenko de563bb5d4 Updated plugin header
Fixes #45
2021-09-28 11:01:39 +03:00
Andrey Savchenko 8875774ddb Fixed non-ASCII characters in Server Timing headers
Fixes #48
2020-11-16 16:17:03 +02:00
Andrey Savchenko ccf3ff3738 Released version 3.3.3 (forgot to update plugin version in header as usual) 2020-03-11 13:23:43 +02:00
Andrey Savchenko cc7670f3c3 Released version 3.3.2 2020-03-11 13:19:54 +02:00
Andrey Savchenko f62eff890a Fixed large server timing headers breaking proxies.
Fixes #40
2020-03-11 13:18:41 +02:00
Andrey Savchenko b0584dea0a Fixed type crash when URL passed to network request filters is invalid.
Fixes #42
2020-03-11 12:58:12 +02:00
Andrey Savchenko dc88dcce1e Adjusted bunch of inline doc to make Psalm pass again. 2020-02-21 18:22:53 +02:00
Andrey Savchenko f4f659c95a Changed bootable interface to inherit so mock can work on PHPUnit 9. 2020-02-21 17:19:02 +02:00
Andrey Savchenko 6be80cc832 Updated dependencies (Mustache.php 2.13) 2020-02-21 17:15:00 +02:00
Andrey Savchenko 4930979989 Dropped no longer used version in file name from readme badges. 2020-02-21 17:11:24 +02:00
Andrey Savchenko 168a226859 Changed download links to native github redirect 2019-12-31 16:14:23 +02:00
Andrey Savchenko 588b597f99 Released version 3.3.1 2019-07-02 14:46:13 +03:00
Andrey Savchenko 54ba716ba8 Fixed crash from broken plugin loaded hook input from global
Fixes #35
2019-07-02 14:46:13 +03:00
Ramon Fincken e2f85f44d2 [TASK] Update link to wp-config define (#38) 2019-07-01 08:03:32 +03:00
Andrey Savchenko a2ae665dd2 Disabled Mixed Psalm errors because I quit. 2019-06-16 00:24:03 +03:00
Andrey Savchenko f8f5e436e5 Fixed global and data Psalm errors. 2019-06-16 00:23:12 +03:00
Andrey Savchenko 6cab9bbd6b Changed Psalm template attempt to type. 2019-06-16 00:22:45 +03:00
Andrey Savchenko 1e9a600096 Psalm cleanup pass. 2019-06-15 10:11:50 +03:00
Andrey Savchenko cc1cdc577a Disabled Psalm error for known deprecated class use. 2019-06-14 20:15:39 +03:00
Andrey Savchenko d3e352d9f3 Adjusted PHPDoc on event classes. 2019-06-14 20:09:54 +03:00
Andrey Savchenko e6bb7fadaa Released version 3.3 2019-03-27 21:42:16 +02:00
Andrey Savchenko bd42c7b6a1 Added tracking load of individual plugin load (WP 5.1+)
Fixes #24
2019-03-27 21:40:52 +02:00
Andrey Savchenko bbc7ff1ada Dropped queries with unknown start time (that never worked). 2019-03-25 19:19:18 +02:00
Andrey Savchenko 7bffa1f49e Added plotting of early SQL queries (WP 5.1+)
Fixes #19
2019-03-24 21:20:55 +02:00
Andrey Savchenko ba72763486 Fixed error when formatting empty hook.
Prop @kellymears Closes #30
2019-03-24 19:52:42 +02:00
Andrey Savchenko 739ed7dd90 Updated unit tests for PHPUnit 8. 2019-03-24 19:32:33 +02:00
43 changed files with 482 additions and 245 deletions

No files matched your search

+46 -1
View File
@@ -6,6 +6,51 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## Unreleased ## Unreleased
## 3.3.5 - 2021-09-21
### Changed
- reduced maximum Server Timing headers size to 2K (half of possible nginx defaults)
### Fixed
- allowed Composer install on PHP 8
## 3.3.4 - 2020-11-16
### Fixed
- non-ASCII characters in Server Timing headers
## 3.3.3 - 2020-03-11
### Fixed
- wrong plugin version in header
## 3.3.2 - 2020-03-11
### Changed
- `Bootable_Provider_Interface` to extend `ServiceProviderInterface`, so that it can be mocked in PHPUnit 9
### Fixed
- Mustache.php version to resolve issues on PHP 7.4
- type crash when URL passed to network request filters is invalid
- large server timing headers breaking proxies
## 3.3.1 - 2019-07-02
### Fixed
- crash from broken plugin loaded hook input from global
## 3.3 - 2019-03-27
### Added
- plotting of early SQL queries (WP 5.1+)
- tracking load of individual plugin load (WP 5.1+)
### Changed
- unit tests for PHPUnit 8
### Fixed
- error when formatting empty hook.
## 3.2 - 2019-01-30 ## 3.2 - 2019-01-30
### Added ### Added
@@ -17,7 +62,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- tracking of load events when network–activated - tracking of load events when network–activated
### Deprecated ### Deprecated
- dedicated classes for extension events. - dedicated classes for extension events
## 3.1 - 2019-01-22 ## 3.1 - 2019-01-22
+11 -4
View File
@@ -10,8 +10,7 @@ _Make a site, make it fast._
[![Total Downloads](https://img.shields.io/packagist/dt/rarst/laps.svg)](https://packagist.org/packages/rarst/laps) [![Total Downloads](https://img.shields.io/packagist/dt/rarst/laps.svg)](https://packagist.org/packages/rarst/laps)
[![Latest Stable Version](https://img.shields.io/packagist/v/rarst/laps.svg?label=version)](https://packagist.org/packages/rarst/laps) [![Latest Stable Version](https://img.shields.io/packagist/v/rarst/laps.svg?label=version)](https://packagist.org/packages/rarst/laps)
[![PHP from Packagist](https://img.shields.io/packagist/php-v/rarst/laps.svg)](https://packagist.org/packages/rarst/laps) [![PHP from Packagist](https://img.shields.io/packagist/php-v/rarst/laps.svg)](https://packagist.org/packages/rarst/laps)
[![PDS Skeleton](https://img.shields.io/badge/pds-skeleton-blue.svg)](https://github.com/php-pds/skeleton) [![Download Laps](https://img.shields.io/badge/download-laps.zip-blue)](https://github.com/Rarst/laps/releases/latest/download/laps.zip)
[![Download Laps](https://img.shields.io/badge/dynamic/json.svg?label=download&url=https://api.github.com/repos/rarst/laps/releases/latest&query=$.assets%5B0%5D.name)](https://www.rarst.net/download/laps)
Laps is a plugin that **shows performance information** about WordPress page load. Laps is a plugin that **shows performance information** about WordPress page load.
@@ -21,7 +20,7 @@ It provides a visual summary in toolbar that is quick and easy to inspect.
Laps automatically tracks many events, such as: Laps automatically tracks many events, such as:
- PHP, core, plugins, and themes load, main posts loop, sidebars - PHP, core, plugins, and themes load, main posts loop, sidebars
- database queries (with [`SAVEQUERIES` constant](http://codex.wordpress.org/Editing_wp-config.php#Save_queries_for_analysis) enabled) - database queries (with [`SAVEQUERIES` defined constant set to true](https://wordpress.org/support/article/editing-wp-config-php/#save-queries-for-analysis))
- network requests to other sites - network requests to other sites
## API profiling ## API profiling
@@ -40,7 +39,15 @@ API requests need to be authenticated as admin for performance data to be sent.
| [Composer](https://getcomposer.org/) (recommended) | Release archive | | [Composer](https://getcomposer.org/) (recommended) | Release archive |
| -------------------------------------------------- | -------- | | -------------------------------------------------- | -------- |
| `composer require rarst/laps` | [![Download Laps](https://img.shields.io/badge/dynamic/json.svg?label=download&url=https%3A%2F%2Fapi.github.com%2Frepos%2Frarst%2Flaps%2Freleases%2Flatest&query=%24.assets[0].name&style=for-the-badge)](https://www.rarst.net/download/laps) | | `composer require rarst/laps` | [![Download Laps](https://img.shields.io/badge/download-laps.zip-blue?style=for-the-badge)](https://github.com/Rarst/laps/releases/latest/download/laps.zip) |
## Tests
Tests require [Brain Monkey](https://github.com/Brain-WP/BrainMonkey) (included in dependencies) and PHPUnit 9 (not included).
```bash
phpunit
```
## License ## License
+2 -2
View File
@@ -25,8 +25,8 @@
} }
}, },
"require" : { "require" : {
"php" : "^7.1.3", "php" : "^7.1.3 || ^8",
"composer/installers": "^1.6", "composer/installers": "^1.6 || ^2",
"symfony/stopwatch" : "^4.2.1", "symfony/stopwatch" : "^4.2.1",
"mustache/mustache" : "^2.12", "mustache/mustache" : "^2.12",
"pimple/pimple" : "^3.2.3" "pimple/pimple" : "^3.2.3"
Generated
+205 -121
View File
@@ -4,38 +4,39 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "185526a596d05cc666426641f175a314", "content-hash": "56d31c242653d4e375949ef0356705dc",
"packages": [ "packages": [
{ {
"name": "composer/installers", "name": "composer/installers",
"version": "v1.6.0", "version": "v2.0.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/installers.git", "url": "https://github.com/composer/installers.git",
"reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b" "reference": "a241e78aaeb09781f5f5b92ac01ffd13ab43e5e8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/installers/zipball/cfcca6b1b60bc4974324efb5783c13dca6932b5b", "url": "https://api.github.com/repos/composer/installers/zipball/a241e78aaeb09781f5f5b92ac01ffd13ab43e5e8",
"reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b", "reference": "a241e78aaeb09781f5f5b92ac01ffd13ab43e5e8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"composer-plugin-api": "^1.0" "composer-plugin-api": "^1.0 || ^2.0",
}, "php": "^7.2 || ^8.0"
"replace": {
"roundcube/plugin-installer": "*",
"shama/baton": "*"
}, },
"require-dev": { "require-dev": {
"composer/composer": "1.0.*@dev", "composer/composer": "1.6.* || ^2.0",
"phpunit/phpunit": "^4.8.36" "composer/semver": "^1 || ^3",
"phpstan/phpstan": "^0.12.55",
"phpstan/phpstan-phpunit": "^0.12.16",
"symfony/phpunit-bridge": "^5.3",
"symfony/process": "^5"
}, },
"type": "composer-plugin", "type": "composer-plugin",
"extra": { "extra": {
"class": "Composer\\Installers\\Plugin", "class": "Composer\\Installers\\Plugin",
"branch-alias": { "branch-alias": {
"dev-master": "1.0-dev" "dev-main": "2.x-dev"
} }
}, },
"autoload": { "autoload": {
@@ -57,7 +58,6 @@
"description": "A multi-framework Composer library installer", "description": "A multi-framework Composer library installer",
"homepage": "https://composer.github.io/installers/", "homepage": "https://composer.github.io/installers/",
"keywords": [ "keywords": [
"Craft",
"Dolibarr", "Dolibarr",
"Eliasis", "Eliasis",
"Hurad", "Hurad",
@@ -65,6 +65,7 @@
"Kanboard", "Kanboard",
"Lan Management System", "Lan Management System",
"MODX Evo", "MODX Evo",
"MantisBT",
"Mautic", "Mautic",
"Maya", "Maya",
"OXID", "OXID",
@@ -72,10 +73,11 @@
"Porto", "Porto",
"RadPHP", "RadPHP",
"SMF", "SMF",
"Starbug",
"Thelia", "Thelia",
"Whmcs",
"WolfCMS", "WolfCMS",
"agl", "agl",
"aimeos",
"annotatecms", "annotatecms",
"attogram", "attogram",
"bitrix", "bitrix",
@@ -94,7 +96,7 @@
"grav", "grav",
"installer", "installer",
"itop", "itop",
"joomla", "known",
"kohana", "kohana",
"laravel", "laravel",
"lavalite", "lavalite",
@@ -103,13 +105,16 @@
"majima", "majima",
"mako", "mako",
"mediawiki", "mediawiki",
"miaoxing",
"modulework", "modulework",
"modx", "modx",
"moodle", "moodle",
"osclass", "osclass",
"pantheon",
"phpbb", "phpbb",
"piwik", "piwik",
"ppi", "ppi",
"processwire",
"puppet", "puppet",
"pxcms", "pxcms",
"reindex", "reindex",
@@ -117,27 +122,45 @@
"shopware", "shopware",
"silverstripe", "silverstripe",
"sydes", "sydes",
"symfony", "sylius",
"typo3", "tastyigniter",
"wordpress", "wordpress",
"yawik", "yawik",
"zend", "zend",
"zikula" "zikula"
], ],
"time": "2018-08-27T06:10:37+00:00" "support": {
"issues": "https://github.com/composer/installers/issues",
"source": "https://github.com/composer/installers/tree/v2.0.1"
},
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://github.com/composer",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2021-09-13T08:21:20+00:00"
}, },
{ {
"name": "mustache/mustache", "name": "mustache/mustache",
"version": "v2.12.0", "version": "v2.13.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/bobthecow/mustache.php.git", "url": "https://github.com/bobthecow/mustache.php.git",
"reference": "fe8fe72e9d580591854de404cc59a1b83ca4d19e" "reference": "e95c5a008c23d3151d59ea72484d4f72049ab7f4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/fe8fe72e9d580591854de404cc59a1b83ca4d19e", "url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/e95c5a008c23d3151d59ea72484d4f72049ab7f4",
"reference": "fe8fe72e9d580591854de404cc59a1b83ca4d19e", "reference": "e95c5a008c23d3151d59ea72484d4f72049ab7f4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -170,33 +193,37 @@
"mustache", "mustache",
"templating" "templating"
], ],
"time": "2017-07-11T12:54:05+00:00" "support": {
"issues": "https://github.com/bobthecow/mustache.php/issues",
"source": "https://github.com/bobthecow/mustache.php/tree/master"
},
"time": "2019-11-23T21:40:31+00:00"
}, },
{ {
"name": "pimple/pimple", "name": "pimple/pimple",
"version": "v3.2.3", "version": "v3.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/silexphp/Pimple.git", "url": "https://github.com/silexphp/Pimple.git",
"reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32" "reference": "86406047271859ffc13424a048541f4531f53601"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/silexphp/Pimple/zipball/9e403941ef9d65d20cba7d54e29fe906db42cf32", "url": "https://api.github.com/repos/silexphp/Pimple/zipball/86406047271859ffc13424a048541f4531f53601",
"reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32", "reference": "86406047271859ffc13424a048541f4531f53601",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.0", "php": ">=7.2.5",
"psr/container": "^1.0" "psr/container": "^1.1"
}, },
"require-dev": { "require-dev": {
"symfony/phpunit-bridge": "^3.2" "symfony/phpunit-bridge": "^5.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.2.x-dev" "dev-master": "3.4.x-dev"
} }
}, },
"autoload": { "autoload": {
@@ -215,36 +242,34 @@
} }
], ],
"description": "Pimple, a simple Dependency Injection Container", "description": "Pimple, a simple Dependency Injection Container",
"homepage": "http://pimple.sensiolabs.org", "homepage": "https://pimple.symfony.com",
"keywords": [ "keywords": [
"container", "container",
"dependency injection" "dependency injection"
], ],
"time": "2018-01-21T07:42:36+00:00" "support": {
"source": "https://github.com/silexphp/Pimple/tree/v3.4.0"
},
"time": "2021-03-06T08:28:00+00:00"
}, },
{ {
"name": "psr/container", "name": "psr/container",
"version": "1.0.0", "version": "1.1.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-fig/container.git", "url": "https://github.com/php-fig/container.git",
"reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf",
"reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.0" "php": ">=7.2.0"
}, },
"type": "library", "type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Psr\\Container\\": "src/" "Psr\\Container\\": "src/"
@@ -257,7 +282,7 @@
"authors": [ "authors": [
{ {
"name": "PHP-FIG", "name": "PHP-FIG",
"homepage": "http://www.php-fig.org/" "homepage": "https://www.php-fig.org/"
} }
], ],
"description": "Common Container Interface (PHP FIG PSR-11)", "description": "Common Container Interface (PHP FIG PSR-11)",
@@ -269,49 +294,47 @@
"container-interop", "container-interop",
"psr" "psr"
], ],
"time": "2017-02-14T16:28:37+00:00" "support": {
"issues": "https://github.com/php-fig/container/issues",
"source": "https://github.com/php-fig/container/tree/1.1.1"
},
"time": "2021-03-05T17:36:06+00:00"
}, },
{ {
"name": "symfony/contracts", "name": "symfony/service-contracts",
"version": "v1.0.2", "version": "v2.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/contracts.git", "url": "https://github.com/symfony/service-contracts.git",
"reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf" "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/contracts/zipball/1aa7ab2429c3d594dd70689604b5cf7421254cdf", "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb",
"reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf", "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.1.3" "php": ">=7.2.5",
}, "psr/container": "^1.1"
"require-dev": {
"psr/cache": "^1.0",
"psr/container": "^1.0"
}, },
"suggest": { "suggest": {
"psr/cache": "When using the Cache contracts", "symfony/service-implementation": ""
"psr/container": "When using the Service contracts",
"symfony/cache-contracts-implementation": "",
"symfony/service-contracts-implementation": "",
"symfony/translation-contracts-implementation": ""
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.0-dev" "dev-main": "2.4-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
} }
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Symfony\\Contracts\\": "" "Symfony\\Contracts\\Service\\": ""
}, }
"exclude-from-classmap": [
"**/Tests/"
]
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
@@ -327,7 +350,7 @@
"homepage": "https://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"description": "A set of abstractions extracted out of the Symfony components", "description": "Generic abstractions related to writing services",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"keywords": [ "keywords": [
"abstractions", "abstractions",
@@ -337,32 +360,44 @@
"interoperability", "interoperability",
"standards" "standards"
], ],
"time": "2018-12-05T08:06:11+00:00" "support": {
"source": "https://github.com/symfony/service-contracts/tree/v2.4.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-04-01T10:43:52+00:00"
}, },
{ {
"name": "symfony/stopwatch", "name": "symfony/stopwatch",
"version": "v4.2.1", "version": "v4.4.27",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/stopwatch.git", "url": "https://github.com/symfony/stopwatch.git",
"reference": "ec076716412274e51f8a7ea675d9515e5c311123" "reference": "c85d997af06a58ba83e2d2538e335b894c24523d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/stopwatch/zipball/ec076716412274e51f8a7ea675d9515e5c311123", "url": "https://api.github.com/repos/symfony/stopwatch/zipball/c85d997af06a58ba83e2d2538e335b894c24523d",
"reference": "ec076716412274e51f8a7ea675d9515e5c311123", "reference": "c85d997af06a58ba83e2d2538e335b894c24523d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.1.3", "php": ">=7.1.3",
"symfony/contracts": "^1.0" "symfony/service-contracts": "^1.0|^2"
}, },
"type": "library", "type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.2-dev"
}
},
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Symfony\\Component\\Stopwatch\\": "" "Symfony\\Component\\Stopwatch\\": ""
@@ -385,29 +420,49 @@
"homepage": "https://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"description": "Symfony Stopwatch Component", "description": "Provides a way to profile code",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-11-11T19:52:12+00:00" "support": {
"source": "https://github.com/symfony/stopwatch/tree/v4.4.27"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-07-10T08:41:57+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [
{ {
"name": "antecedent/patchwork", "name": "antecedent/patchwork",
"version": "2.1.8", "version": "2.1.15",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/antecedent/patchwork.git", "url": "https://github.com/antecedent/patchwork.git",
"reference": "3bb81ace3914c220aa273d1c0603d5e1b454c0d7" "reference": "0430ceaac7f447f1778c199ec19d7e4362a6f961"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/antecedent/patchwork/zipball/3bb81ace3914c220aa273d1c0603d5e1b454c0d7", "url": "https://api.github.com/repos/antecedent/patchwork/zipball/0430ceaac7f447f1778c199ec19d7e4362a6f961",
"reference": "3bb81ace3914c220aa273d1c0603d5e1b454c0d7", "reference": "0430ceaac7f447f1778c199ec19d7e4362a6f961",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.4.0" "php": ">=5.4.0"
}, },
"require-dev": {
"phpunit/phpunit": ">=4"
},
"type": "library", "type": "library",
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
@@ -430,20 +485,24 @@
"runkit", "runkit",
"testing" "testing"
], ],
"time": "2018-02-19T18:52:50+00:00" "support": {
"issues": "https://github.com/antecedent/patchwork/issues",
"source": "https://github.com/antecedent/patchwork/tree/2.1.15"
},
"time": "2021-08-22T08:00:13+00:00"
}, },
{ {
"name": "brain/monkey", "name": "brain/monkey",
"version": "2.2.0", "version": "2.6.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Brain-WP/BrainMonkey.git", "url": "https://github.com/Brain-WP/BrainMonkey.git",
"reference": "ed9e0698bc1292f33698719da8ca1aa2e18acc51" "reference": "7042140000b4b18034c0c0010d86274a00f25442"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Brain-WP/BrainMonkey/zipball/ed9e0698bc1292f33698719da8ca1aa2e18acc51", "url": "https://api.github.com/repos/Brain-WP/BrainMonkey/zipball/7042140000b4b18034c0c0010d86274a00f25442",
"reference": "ed9e0698bc1292f33698719da8ca1aa2e18acc51", "reference": "7042140000b4b18034c0c0010d86274a00f25442",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -452,7 +511,9 @@
"php": ">=5.6.0" "php": ">=5.6.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~5.7.9" "dealerdirect/phpcodesniffer-composer-installer": "^0.6 || ^0.7",
"phpcompatibility/php-compatibility": "^9.3.0",
"phpunit/phpunit": "^5.7.9 || ^6.0 || ^7.0 || ^8.0 || ^9.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@@ -494,24 +555,28 @@
"test", "test",
"testing" "testing"
], ],
"time": "2017-12-01T16:32:09+00:00" "support": {
"issues": "https://github.com/Brain-WP/BrainMonkey/issues",
"source": "https://github.com/Brain-WP/BrainMonkey"
},
"time": "2020-10-13T17:56:14+00:00"
}, },
{ {
"name": "hamcrest/hamcrest-php", "name": "hamcrest/hamcrest-php",
"version": "v2.0.0", "version": "v2.0.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/hamcrest/hamcrest-php.git", "url": "https://github.com/hamcrest/hamcrest-php.git",
"reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad" "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/776503d3a8e85d4f9a1148614f95b7a608b046ad", "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/8c3d0a3f6af734494ad8f6fbbee0ba92422859f3",
"reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad", "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^5.3|^7.0" "php": "^5.3|^7.0|^8.0"
}, },
"replace": { "replace": {
"cordoval/hamcrest-php": "*", "cordoval/hamcrest-php": "*",
@@ -519,14 +584,13 @@
"kodova/hamcrest-php": "*" "kodova/hamcrest-php": "*"
}, },
"require-dev": { "require-dev": {
"phpunit/php-file-iterator": "1.3.3", "phpunit/php-file-iterator": "^1.4 || ^2.0",
"phpunit/phpunit": "~4.0", "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0"
"satooshi/php-coveralls": "^1.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.0-dev" "dev-master": "2.1-dev"
} }
}, },
"autoload": { "autoload": {
@@ -536,40 +600,47 @@
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"BSD" "BSD-3-Clause"
], ],
"description": "This is the PHP port of Hamcrest Matchers", "description": "This is the PHP port of Hamcrest Matchers",
"keywords": [ "keywords": [
"test" "test"
], ],
"time": "2016-01-20T08:20:44+00:00" "support": {
"issues": "https://github.com/hamcrest/hamcrest-php/issues",
"source": "https://github.com/hamcrest/hamcrest-php/tree/v2.0.1"
},
"time": "2020-07-09T08:09:16+00:00"
}, },
{ {
"name": "mockery/mockery", "name": "mockery/mockery",
"version": "1.2.0", "version": "1.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/mockery/mockery.git", "url": "https://github.com/mockery/mockery.git",
"reference": "100633629bf76d57430b86b7098cd6beb996a35a" "reference": "e01123a0e847d52d186c5eb4b9bf58b0c6d00346"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/mockery/mockery/zipball/100633629bf76d57430b86b7098cd6beb996a35a", "url": "https://api.github.com/repos/mockery/mockery/zipball/e01123a0e847d52d186c5eb4b9bf58b0c6d00346",
"reference": "100633629bf76d57430b86b7098cd6beb996a35a", "reference": "e01123a0e847d52d186c5eb4b9bf58b0c6d00346",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"hamcrest/hamcrest-php": "~2.0", "hamcrest/hamcrest-php": "^2.0.1",
"lib-pcre": ">=7.0", "lib-pcre": ">=7.0",
"php": ">=5.6.0" "php": "^7.3 || ^8.0"
},
"conflict": {
"phpunit/phpunit": "<8.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~5.7.10|~6.5|~7.0" "phpunit/phpunit": "^8.5 || ^9.3"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.0.x-dev" "dev-master": "1.4.x-dev"
} }
}, },
"autoload": { "autoload": {
@@ -607,7 +678,11 @@
"test double", "test double",
"testing" "testing"
], ],
"time": "2018-10-02T21:52:37+00:00" "support": {
"issues": "https://github.com/mockery/mockery/issues",
"source": "https://github.com/mockery/mockery/tree/1.4.4"
},
"time": "2021-09-13T15:28:59+00:00"
}, },
{ {
"name": "pds/skeleton", "name": "pds/skeleton",
@@ -638,20 +713,24 @@
], ],
"description": "Standard for PHP package skeletons.", "description": "Standard for PHP package skeletons.",
"homepage": "https://github.com/php-pds/skeleton", "homepage": "https://github.com/php-pds/skeleton",
"support": {
"issues": "https://github.com/php-pds/skeleton/issues",
"source": "https://github.com/php-pds/skeleton/tree/1.x"
},
"time": "2017-01-25T23:30:41+00:00" "time": "2017-01-25T23:30:41+00:00"
}, },
{ {
"name": "twbs/bootstrap", "name": "twbs/bootstrap",
"version": "v3.4.0", "version": "v3.4.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/twbs/bootstrap.git", "url": "https://github.com/twbs/bootstrap.git",
"reference": "4c547f2175b9a05aa43551f6927da83fe249ce42" "reference": "68b0d231a13201eb14acd3dc84e51543d16e5f7e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/twbs/bootstrap/zipball/4c547f2175b9a05aa43551f6927da83fe249ce42", "url": "https://api.github.com/repos/twbs/bootstrap/zipball/68b0d231a13201eb14acd3dc84e51543d16e5f7e",
"reference": "4c547f2175b9a05aa43551f6927da83fe249ce42", "reference": "68b0d231a13201eb14acd3dc84e51543d16e5f7e",
"shasum": "" "shasum": ""
}, },
"replace": { "replace": {
@@ -689,7 +768,11 @@
"responsive", "responsive",
"web" "web"
], ],
"time": "2018-12-13T23:45:51+00:00" "support": {
"issues": "https://github.com/twbs/bootstrap/issues",
"source": "https://github.com/twbs/bootstrap/tree/v3.4.1"
},
"time": "2019-02-13T15:55:38+00:00"
} }
], ],
"aliases": [], "aliases": [],
@@ -698,7 +781,8 @@
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": { "platform": {
"php": "^7.1.3" "php": "^7.1.3 || ^8"
}, },
"platform-dev": [] "platform-dev": [],
"plugin-api-version": "2.1.0"
} }
+3 -3
View File
@@ -5,10 +5,10 @@ Plugin Name: Laps
Plugin URI: https://github.com/Rarst/laps Plugin URI: https://github.com/Rarst/laps
Description: Light WordPress profiler. Description: Light WordPress profiler.
Author: Andrey “Rarst” Savchenko Author: Andrey “Rarst” Savchenko
Version: 3.2 Version: 3.3.5
Author URI: https://www.rarst.net/ Author URI: https://www.rarst.net/
Text Domain: laps Requires PHP: 7.1.3
Domain Path: /lang Update URI: false
License: MIT License: MIT
*/ */
+4 -24
View File
@@ -1,6 +1,6 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<psalm <psalm
totallyTyped="true" totallyTyped="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config" xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
@@ -16,28 +16,8 @@
<issueHandlers> <issueHandlers>
<LessSpecificReturnType errorLevel="info"/> <LessSpecificReturnType errorLevel="info"/>
<UndefinedFunction errorLevel="suppress"/> <UndefinedFunction errorLevel="suppress"/>
<UndefinedClass> <UndefinedClass errorLevel="suppress"/>
<errorLevel type="suppress"> <UndefinedDocblockClass errorLevel="suppress"/>
<referencedClass name="WP_Admin_Bar"/> <UndefinedConstant errorLevel="suppress"/>
<referencedClass name="WP_Error"/>
<referencedClass name="WP_Hook"/>
</errorLevel>
</UndefinedClass>
<MixedArgument>
<errorLevel type="suppress">
<file name="src/Provider/Record_Provider.php" />
<file name="src/Record/Collector/Hook_Collector.php" />
</errorLevel>
</MixedArgument>
<MissingClosureParamType>
<errorLevel type="suppress">
<file name="src/Record/Collector/Hook_Collector.php" />
</errorLevel>
</MissingClosureParamType>
<MissingClosureReturnType>
<errorLevel type="suppress">
<file name="src/Record/Collector/Hook_Collector.php" />
</errorLevel>
</MissingClosureReturnType>
</issueHandlers> </issueHandlers>
</psalm> </psalm>
+1 -1
View File
@@ -9,7 +9,7 @@ namespace Rarst\Laps\Event;
class Core_Events implements Hook_Event_Config_Interface { class Core_Events implements Hook_Event_Config_Interface {
/** /**
* @return array * @inheritDoc
*/ */
public function get_events(): array { public function get_events(): array {
+2 -2
View File
@@ -9,7 +9,7 @@ namespace Rarst\Laps\Event;
class Extension_Events implements Hook_Event_Config_Interface { class Extension_Events implements Hook_Event_Config_Interface {
/** /**
* @return array[] * @inheritDoc
*/ */
public function get_events(): array { public function get_events(): array {
@@ -19,7 +19,7 @@ class Extension_Events implements Hook_Event_Config_Interface {
/** /**
* Beaver Builder events. * Beaver Builder events.
* *
* @return array * @return array[]
*/ */
private function beaver_builder(): array { private function beaver_builder(): array {
+1 -1
View File
@@ -13,7 +13,7 @@ namespace Rarst\Laps\Event;
class Genesis_Events implements Hook_Event_Config_Interface { class Genesis_Events implements Hook_Event_Config_Interface {
/** /**
* @return array * @inheritDoc
*/ */
public function get_events(): array { public function get_events(): array {
+1 -1
View File
@@ -13,7 +13,7 @@ namespace Rarst\Laps\Event;
class Hybrid_Events implements Hook_Event_Config_Interface { class Hybrid_Events implements Hook_Event_Config_Interface {
/** /**
* @return array * @inheritDoc
*/ */
public function get_events(): array { public function get_events(): array {
+1 -1
View File
@@ -13,7 +13,7 @@ namespace Rarst\Laps\Event;
class THA_Events implements Hook_Event_Config_Interface { class THA_Events implements Hook_Event_Config_Interface {
/** /**
* @return array * @inheritDoc
*/ */
public function get_events(): array { public function get_events(): array {
+1 -1
View File
@@ -11,7 +11,7 @@ namespace Rarst\Laps\Event;
class WooCommerce_Events implements Hook_Event_Config_Interface { class WooCommerce_Events implements Hook_Event_Config_Interface {
/** /**
* @return array * @inheritDoc
*/ */
public function get_events(): array { public function get_events(): array {
+1 -1
View File
@@ -11,7 +11,7 @@ namespace Rarst\Laps\Event;
class Yoast_Events implements Hook_Event_Config_Interface { class Yoast_Events implements Hook_Event_Config_Interface {
/** /**
* @return array * @inheritDoc
*/ */
public function get_events(): array { public function get_events(): array {
+2 -3
View File
@@ -76,13 +76,12 @@ class Backtrace_Formatter {
} }
/** /**
*
* @psalm-suppress PossiblyFalseOperand
* *
* @param string $item Backtrace item. * @param string $item Backtrace item.
* *
* @return string * @return string
*
* @psalm-suppress PossiblyFalseOperand
* @psalm-suppress MixedInferredReturnType
*/ */
protected function shorten_include( string $item ): string { protected function shorten_include( string $item ): string {
+22 -8
View File
@@ -16,6 +16,7 @@ class Hook_Formatter {
*/ */
public function __construct() { public function __construct() {
// TODO inject paths instead of reaching for global constants.
$this->truncate_paths = [ $this->truncate_paths = [
wp_normalize_path( WP_CONTENT_DIR ), wp_normalize_path( WP_CONTENT_DIR ),
wp_normalize_path( ABSPATH ), wp_normalize_path( ABSPATH ),
@@ -24,7 +25,14 @@ class Hook_Formatter {
} }
/** /**
* @psalm-type Callback = string|object|array
* @psalm-type AcceptedArgs = int
* @psalm-type Hook = array{function: Callback, accepted_args: AcceptedArgs}
* @psalm-type Priority = array-key
* @psalm-type Hooks = array<Priority, array<Hook>>
*
* @param \WP_Hook|array $hook Hook instance. * @param \WP_Hook|array $hook Hook instance.
* @psalm-param \WP_Hook|Hooks $hook
* *
* @return array * @return array
*/ */
@@ -33,8 +41,14 @@ class Hook_Formatter {
$callbacks = []; $callbacks = [];
if ( $hook instanceof \WP_Hook ) { if ( $hook instanceof \WP_Hook ) {
/** @psalm-var Hooks $hook->callbacks */
$hook = $hook->callbacks; $hook = $hook->callbacks;
} }
if ( empty( $hook ) ) {
return $callbacks;
}
ksort( $hook ); ksort( $hook );
$functions = array_merge( ...$hook ); $functions = array_merge( ...$hook );
@@ -55,27 +69,27 @@ class Hook_Formatter {
/** /**
* @param string|object|array $callback Hook callback. * @param string|object|array $callback Hook callback.
* @param int $args Number of accepted arguments. * @param int $args Number of accepted arguments.
*
* @return string
*/ */
protected function get_callback_name( $callback, int $args ): string { protected function get_callback_name( $callback, int $args ): string {
switch ( gettype( $callback ) ) { switch ( gettype( $callback ) ) {
case 'object': case 'object':
$callback = $this->get_class_name( $callback ); $name = $this->get_class_name( $callback );
break; break;
case 'array': case 'array':
/** @psalm-var array{0: object|string, 1: string} $callback */
$class = is_string( $callback[0] ) $class = is_string( $callback[0] )
? $callback[0] . '::' ? $callback[0] . '::'
: $this->get_class_name( $callback[0] ) . '->'; : $this->get_class_name( $callback[0] ) . '->';
$callback = $class . $callback[1]; $name = $class . $callback[1];
break; break;
default:
$name = $callback;
} }
$callback .= ( 1 === $args ) ? '' : "({$args})"; return $name . ( ( 1 === $args ) ? '' : "({$args})" );
return $callback;
} }
/** /**
@@ -85,7 +99,7 @@ class Hook_Formatter {
*/ */
protected function get_class_name( $object ): string { protected function get_class_name( $object ): string {
if ( is_a( $object, 'CLosure' ) ) { if ( $object instanceof \Closure ) {
$class = new \ReflectionFunction( $object ); $class = new \ReflectionFunction( $object );
return 'closure from ' . $this->shorten_path( $class->getFileName() ) . ':' . $class->getStartLine(); return 'closure from ' . $this->shorten_path( $class->getFileName() ) . ':' . $class->getStartLine();
-2
View File
@@ -21,8 +21,6 @@ class Load_Order_Manager {
* Reorder active plugins so Laps is first and starts timing load early. * Reorder active plugins so Laps is first and starts timing load early.
* *
* @param array $plugins Filtered array of active plugins’ basenames. * @param array $plugins Filtered array of active plugins’ basenames.
*
* @return array
*/ */
public function pre_update_option_active_plugins( array $plugins ): array { public function pre_update_option_active_plugins( array $plugins ): array {
+7 -2
View File
@@ -57,14 +57,19 @@ class Server_Timing_Manager {
foreach ( $this->collector->get_records() as $record ) { foreach ( $this->collector->get_records() as $record ) {
$duration = $record->get_duration() * 1000; $duration = $record->get_duration() * 1000;
if ( $duration < 1 ) { if ( $duration < 1 ) { // Filter out less than 1ms events as too noisy.
continue; continue;
} }
$header .= sprintf( '%s;dur=%.2f;desc="%s", ', $record->get_category(), $duration, $record->get_name() ); $header .= sprintf( '%s;dur=%.2f;desc="%s", ', $record->get_category(), $duration, $record->get_name() );
if ( strlen( $header ) > 2000 ) { // 8+KB headers break proxies, 4+KB nginx, so we cut off at 1/2 that limit.
break;
}
} }
header( 'Server-Timing: ' . preg_replace( '/\R/', '', $header ) ); // Sanitize to visible US ASCII character range (32-126).
header( 'Server-Timing: ' . preg_replace( '/[^\x20-\x7E]/', '', $header ) );
return $input; return $input;
} }
-2
View File
@@ -36,8 +36,6 @@ class Toolbar_Manager {
* Render interface and add to the toolbar. * Render interface and add to the toolbar.
* *
* @param \WP_Admin_Bar $wp_admin_bar WordPress core toolbar object. * @param \WP_Admin_Bar $wp_admin_bar WordPress core toolbar object.
*
* @psalm-suppress MixedArgument
*/ */
public function admin_bar_menu( \WP_Admin_Bar $wp_admin_bar ): void { public function admin_bar_menu( \WP_Admin_Bar $wp_admin_bar ): void {
+2 -2
View File
@@ -11,12 +11,12 @@ class Mustache_Cache_FrozenCache extends \Mustache_Cache_FilesystemCache {
/** /**
* Cache and load a compiled Mustache_Template class. * Cache and load a compiled Mustache_Template class.
* *
* @psalm-suppress InvalidScalarArgument
*
* @param string $key Key. * @param string $key Key.
* @param string $value Value. * @param string $value Value.
* *
* @return void * @return void
*
* @psalm-suppress InvalidScalarArgument
*/ */
public function cache( $key, $value ): void { public function cache( $key, $value ): void {
+1 -5
View File
@@ -20,9 +20,7 @@ class Plugin extends Container {
/** /**
* @param array $values Configuration values to apply. * @param array $values Configuration values to apply.
* * @psalm-param array<string, mixed> $values
* @psalm-suppress MixedArgument
* @psalm-suppress MixedAssignment
*/ */
public function __construct( array $values = [] ) { public function __construct( array $values = [] ) {
@@ -63,8 +61,6 @@ class Plugin extends Container {
/** /**
* Start Stopwatch and timing plugin load immediately, then set up core events and needed hooks. * Start Stopwatch and timing plugin load immediately, then set up core events and needed hooks.
*
* @psalm-suppress MixedAssignment
*/ */
public function run(): void { public function run(): void {
+2 -1
View File
@@ -3,12 +3,13 @@ declare( strict_types=1 );
namespace Rarst\Laps\Provider; namespace Rarst\Laps\Provider;
use Pimple\ServiceProviderInterface;
use Rarst\Laps\Plugin; use Rarst\Laps\Plugin;
/** /**
* Interface for providers that need to boot up once plugin is ready to start. * Interface for providers that need to boot up once plugin is ready to start.
*/ */
interface Bootable_Provider_Interface { interface Bootable_Provider_Interface extends ServiceProviderInterface {
/** /**
* @param Plugin $laps Container instance. * @param Plugin $laps Container instance.
+2
View File
@@ -20,6 +20,8 @@ class Hook_Event_Provider implements ServiceProviderInterface {
/** /**
* @param Container $pimple Container instance. * @param Container $pimple Container instance.
*
* @psalm-suppress DeprecatedClass
*/ */
public function register( Container $pimple ): void { public function register( Container $pimple ): void {
+2
View File
@@ -10,6 +10,7 @@ use Rarst\Laps\Record\Collector\Core_Load_Collector;
use Rarst\Laps\Record\Collector\Hook_Collector; use Rarst\Laps\Record\Collector\Hook_Collector;
use Rarst\Laps\Record\Collector\Http_Collector; use Rarst\Laps\Record\Collector\Http_Collector;
use Rarst\Laps\Record\Collector\Lazy_Proxy_Collector; use Rarst\Laps\Record\Collector\Lazy_Proxy_Collector;
use Rarst\Laps\Record\Collector\Plugin_Load_Collector;
use Rarst\Laps\Record\Collector\Sql_Collector; use Rarst\Laps\Record\Collector\Sql_Collector;
use Symfony\Component\Stopwatch\Stopwatch; use Symfony\Component\Stopwatch\Stopwatch;
@@ -31,6 +32,7 @@ class Record_Provider implements ServiceProviderInterface, Bootable_Provider_Int
return [ return [
'core' => new Core_Load_Collector(), 'core' => new Core_Load_Collector(),
'hook' => new Hook_Collector( $laps['stopwatch'], $laps['hook.events'] ), 'hook' => new Hook_Collector( $laps['stopwatch'], $laps['hook.events'] ),
'plugins' => new Plugin_Load_Collector(),
'http' => new Http_Collector( $laps['stopwatch'] ), 'http' => new Http_Collector( $laps['stopwatch'] ),
'sql' => new Sql_Collector(), 'sql' => new Sql_Collector(),
]; ];
+17 -5
View File
@@ -20,13 +20,19 @@ class Hook_Collector extends Stopwatch_Collector {
/** @var array $events */ /** @var array $events */
protected $events = []; protected $events = [];
/** @var array */ /**
* @var array $callbacks
* @psalm-var array<string, \WP_Hook> $callbacks
*/
protected $callbacks = []; protected $callbacks = [];
/** @var Hook_Formatter */ /** @var Hook_Formatter */
protected $formatter; protected $formatter;
/** @var array $calls Tracks number of calls for recurrent events. */ /**
* @var array $calls Tracks number of calls for recurrent events.
* @psalm-var array<string, int> $calls
*/
private $calls = []; private $calls = [];
/** /**
@@ -55,7 +61,7 @@ class Hook_Collector extends Stopwatch_Collector {
/** /**
* Time the point between network/MU plugins and regular if network activated. * Time the point between network/MU plugins and regular if network activated.
*/ */
public function muplugins_loaded() { public function muplugins_loaded(): void {
$this->stop( 'Network & MU Plugins Load' ); $this->stop( 'Network & MU Plugins Load' );
$this->start( 'Plugins Load', 'plugin' ); $this->start( 'Plugins Load', 'plugin' );
} }
@@ -72,11 +78,11 @@ class Hook_Collector extends Stopwatch_Collector {
/** /**
* @var int|string $key * @var int|string $key
* @var array $data * @var array $data
* @psalm-var array{0:string} $data
*/ */
foreach ( $stops as $key => $data ) { foreach ( $stops as $key => $data ) {
if ( is_int( $key ) ) { if ( is_int( $key ) ) {
/** @var array{0:string} $data */
$this->add_event( ...$data ); $this->add_event( ...$data );
continue; continue;
} }
@@ -97,6 +103,9 @@ class Hook_Collector extends Stopwatch_Collector {
* @param string|null $stop Stop hook name (defaults to start name). Pass empty string to ignore. * @param string|null $stop Stop hook name (defaults to start name). Pass empty string to ignore.
* @param int $start_priority Start hook priority (defaults to -1). * @param int $start_priority Start hook priority (defaults to -1).
* @param int $stop_priority Stop hook priority (defaults to max int). * @param int $stop_priority Stop hook priority (defaults to max int).
*
* @psalm-suppress MissingClosureReturnType
* @psalm-suppress MissingClosureParamType
*/ */
private function add_event( private function add_event(
string $event, string $event,
@@ -112,15 +121,17 @@ class Hook_Collector extends Stopwatch_Collector {
if ( '' !== $start ) { if ( '' !== $start ) {
add_action( $start, function ( $input = null ) use ( $event, $category, $start, $stop ) { add_action( $start, function ( $input = null ) use ( $event, $category, $start, $stop ) {
global $wp_filter;
$event .= $this->get_count_suffix( $event, true ); $event .= $this->get_count_suffix( $event, true );
if ( 'Sidebar' === $event ) { if ( 'Sidebar' === $event ) {
/** @var string $input */
$event = $input; $event = $input;
} }
if ( $start === $stop ) { if ( $start === $stop ) {
global $wp_filter; /** @psalm-var array<string, \WP_Hook> $wp_filter */
$this->callbacks[ $event ] = $wp_filter[ $start ]; $this->callbacks[ $event ] = $wp_filter[ $start ];
} }
@@ -136,6 +147,7 @@ class Hook_Collector extends Stopwatch_Collector {
$event .= $this->get_count_suffix( $event ); $event .= $this->get_count_suffix( $event );
if ( 'Sidebar' === $event ) { if ( 'Sidebar' === $event ) {
/** @var string $input */
$event = $input; $event = $input;
} }
+17 -6
View File
@@ -16,7 +16,10 @@ class Http_Collector extends Stopwatch_Collector {
/** @var Backtrace_Formatter */ /** @var Backtrace_Formatter */
private $formatter; private $formatter;
/** @var array */ /**
* @var array $callers
* @psalm-var array<string, string> $callers
*/
private $callers = []; private $callers = [];
/** /**
@@ -39,12 +42,17 @@ class Http_Collector extends Stopwatch_Collector {
* @param array $args HTTP request arguments. * @param array $args HTTP request arguments.
* @param string $url The request URL. * @param string $url The request URL.
* *
* @return boolean * @return false|array|\WP_Error
*
* @psalm-suppress RedundantConditionGivenDocblockType
* @noinspection PhpUnusedParameterInspection
*/ */
public function pre_http_request( $false, array $args, string $url ) { public function pre_http_request( $false, $args, $url ) {
if ( $url && is_string( $url ) ) {
$this->start( $url, 'http' ); $this->start( $url, 'http' );
$this->callers[ $url ] = wp_debug_backtrace_summary( __CLASS__, 5 ); $this->callers[ $url ] = wp_debug_backtrace_summary( __CLASS__, 5 );
}
return $false; return $false;
} }
@@ -58,13 +66,16 @@ class Http_Collector extends Stopwatch_Collector {
* @param array $args HTTP request arguments. * @param array $args HTTP request arguments.
* @param string $url The request URL. * @param string $url The request URL.
* *
* @return mixed * @return array|\WP_Error
* *
* @noinspection MoreThanThreeArgumentsInspection * @psalm-suppress RedundantConditionGivenDocblockType
* @noinspection PhpUnusedParameterInspection
*/ */
public function http_api_debug( $response, string $type, $class, array $args, string $url ) { public function http_api_debug( $response, $type, $class, $args, $url ) {
if ( $url && is_string( $url ) ) {
$this->stop( $url ); $this->stop( $url );
}
return $response; return $response;
} }
@@ -0,0 +1,76 @@
<?php
declare( strict_types=1 );
namespace Rarst\Laps\Record\Collector;
use Rarst\Laps\Record\Record;
use Rarst\Laps\Record\Record_Interface;
/**
* Tracks load time of individual plugins.
*/
class Plugin_Load_Collector implements Record_Collector_Interface {
/** @var float */
private $last;
/** @var array */
private $entries = [];
/**
* Sets up start time and tracking callbacks.
*/
public function __construct() {
$this->last = microtime( true );
add_action( 'network_plugin_loaded', [ $this, 'plugin_loaded' ] );
add_action( 'plugin_loaded', [ $this, 'plugin_loaded' ] );
}
/**
* Records time for a plugin that just finished loading.
*
* @param string $plugin Plugin file path.
*
* @psalm-suppress DocblockTypeContradiction
*/
public function plugin_loaded( $plugin ): void {
$time = microtime( true );
if ( ! is_string( $plugin ) ) { // Broken hook input from global.
$this->last = $time;
return;
}
$this->entries[] = [
'name' => $plugin,
'origin' => $this->last,
'duration' => $time - $this->last,
];
$this->last = $time;
}
/**
* @return Record_Interface[]
*/
public function get_records(): array {
return array_map( [ $this, 'create_record' ], $this->entries );
}
/**
* Converts recorded information into a Record instance.
*
* @param array $entry Data entry for the plugin.
*/
private function create_record( array $entry ): Record {
return new Record(
plugin_basename( $entry['name'] ),
$entry['origin'],
$entry['duration'],
'',
'plugin'
);
}
}
+13 -11
View File
@@ -8,6 +8,8 @@ use Rarst\Laps\Record\Record;
/** /**
* Processes SQL events from data logged by wpdb. * Processes SQL events from data logged by wpdb.
*
* @template QueryData as array{0: string, 1: float, 2: string, 3: float}
*/ */
class Sql_Collector implements Record_Collector_Interface { class Sql_Collector implements Record_Collector_Interface {
@@ -25,7 +27,7 @@ class Sql_Collector implements Record_Collector_Interface {
$this->formatter = new Backtrace_Formatter(); $this->formatter = new Backtrace_Formatter();
if ( $this->is_savequeries() ) { if ( $this->is_savequeries() ) {
add_filter( 'query', [ $this, 'query' ], 20 ); // TODO refactor when core provides time start data in 5.0. add_filter( 'query', [ $this, 'query' ], 20 ); // TODO Drop recording time if dropping support for WP <5.1.
} }
} }
@@ -35,8 +37,6 @@ class Sql_Collector implements Record_Collector_Interface {
* @param string $query SQL query. * @param string $query SQL query.
* *
* @return string * @return string
*
* @psalm-suppress MixedPropertyFetch
*/ */
public function query( $query ): string { public function query( $query ): string {
@@ -64,7 +64,10 @@ class Sql_Collector implements Record_Collector_Interface {
} }
/** @var array $wpdb->queries */ /** @var array $wpdb->queries */
return array_map( [ $this, 'transform' ], array_keys( $wpdb->queries ), $wpdb->queries ); /** @psalm-var array<int, QueryData> $wpdb->queries */
$records = array_filter( array_map( [ $this, 'transform' ], array_keys( $wpdb->queries ), $wpdb->queries ) );
return $records;
} }
/** /**
@@ -80,25 +83,24 @@ class Sql_Collector implements Record_Collector_Interface {
* *
* @param int $key Query key in captured data. * @param int $key Query key in captured data.
* @param array $query_data Array of captured query data. * @param array $query_data Array of captured query data.
* @psalm-param array{0: string, 1: float, 2: string} $query_data * @psalm-param array{0: string, 1: float, 2: string, 3: float} $query_data
* *
* @return Record * @return Record
*/ */
protected function transform( int $key, array $query_data ): Record { protected function transform( int $key, array $query_data ): ?Record {
static $last_query_end = 0;
[ $sql, $duration, $caller ] = $query_data; [ $sql, $duration, $caller ] = $query_data;
/** @var float $query_start */ /** @var float $query_start */
$query_start = $this->query_starts[ $key ] ?? $last_query_end; $query_start = $query_data[3] ?? $this->query_starts[ $key ] ?? 0;
if ( empty( $query_start ) ) {
return null;
}
$sql = trim( $sql ); $sql = trim( $sql );
$category = 'sql-read'; $category = 'sql-read';
if ( 0 === stripos( $sql, 'INSERT' ) || 0 === stripos( $sql, 'UPDATE' ) ) { if ( 0 === stripos( $sql, 'INSERT' ) || 0 === stripos( $sql, 'UPDATE' ) ) {
$category = 'sql-write'; $category = 'sql-write';
} }
$last_query_end = $query_start + $duration;
$desc_duration = round( $duration * 1000 ); $desc_duration = round( $duration * 1000 );
$backtrace = $this->formatter->format( $caller ); $backtrace = $this->formatter->format( $caller );
$description = $sql . ' – ' . $desc_duration . 'ms<hr />' . implode( '<br />', $backtrace ); $description = $sql . ' – ' . $desc_duration . 'ms<hr />' . implode( '<br />', $backtrace );
@@ -51,6 +51,7 @@ class Stopwatch_Collector implements Record_Collector_Interface {
*/ */
public function get_records(): array { public function get_records(): array {
/** @psalm-var array<string, StopwatchEvent> $events */
$events = $this->stopwatch->getSectionEvents( '__root__' ); $events = $this->stopwatch->getSectionEvents( '__root__' );
/** @var string $name */ /** @var string $name */
+6 -6
View File
@@ -17,7 +17,7 @@ class EventTest extends LapsTestCase {
$events = ( new Core_Events() )->get_events(); $events = ( new Core_Events() )->get_events();
$this->assertInternalType( 'array', $events ); $this->assertIsArray( $events );
$this->assertNotEmpty( $events ); $this->assertNotEmpty( $events );
} }
@@ -29,7 +29,7 @@ class EventTest extends LapsTestCase {
Functions\expect( 'genesis' )->zeroOrMoreTimes(); Functions\expect( 'genesis' )->zeroOrMoreTimes();
$events = $genesis->get_events(); $events = $genesis->get_events();
$this->assertInternalType( 'array', $events ); $this->assertIsArray( $events );
$this->assertNotEmpty( $events ); $this->assertNotEmpty( $events );
} }
@@ -46,7 +46,7 @@ class EventTest extends LapsTestCase {
$events = $hybrid->get_events(); $events = $hybrid->get_events();
$this->assertInternalType( 'array', $events ); $this->assertIsArray( $events );
$this->assertNotEmpty( $events ); $this->assertNotEmpty( $events );
} }
@@ -59,7 +59,7 @@ class EventTest extends LapsTestCase {
$events = $tha->get_events(); $events = $tha->get_events();
$this->assertInternalType( 'array', $events ); $this->assertIsArray( $events );
$this->assertNotEmpty( $events ); $this->assertNotEmpty( $events );
} }
@@ -72,7 +72,7 @@ class EventTest extends LapsTestCase {
$events = $woocommerce->get_events(); $events = $woocommerce->get_events();
$this->assertInternalType( 'array', $events ); $this->assertIsArray( $events );
$this->assertNotEmpty( $events ); $this->assertNotEmpty( $events );
} }
@@ -85,7 +85,7 @@ class EventTest extends LapsTestCase {
$events = $yoast->get_events(); $events = $yoast->get_events();
$this->assertInternalType( 'array', $events ); $this->assertIsArray( $events );
$this->assertNotEmpty( $events ); $this->assertNotEmpty( $events );
} }
} }
+4 -2
View File
@@ -51,8 +51,10 @@ class BacktraceTest extends LapsTestCase {
$result = $formatter->format( $backtrace ); $result = $formatter->format( $backtrace );
$this->assertInternalType( 'array', $result ); $this->assertIsArray( $result );
$this->assertArraySubset( [ 'foo', 'path.php' ], array_values( $result ) ); $result = array_values( $result );
$this->assertEquals( 'foo', $result[0] );
$this->assertEquals( 'path.php', $result[1] );
} }
} }
+5 -2
View File
@@ -50,10 +50,13 @@ class HookTest extends LapsTestCase {
$result = $formatter->format( $hook ); $result = $formatter->format( $hook );
$this->assertInternalType( 'array', $result ); $this->assertIsArray( $result );
$this->assertArraySubset( [ 'function(2)', 'class::method' ], $result ); $this->assertEquals( 'function(2)', $result[0] );
$this->assertEquals( 'class::method', $result[1] );
$this->assertStringStartsWith( 'closure from', $result[2] ); $this->assertStringStartsWith( 'closure from', $result[2] );
$this->assertStringStartsWith( 'anonymous class from', $result[3] ); $this->assertStringStartsWith( 'anonymous class from', $result[3] );
$this->assertEquals( [], $formatter->format( [] ) );
} }
} }
+2 -2
View File
@@ -10,12 +10,12 @@ class LapsTestCase extends TestCase {
use MockeryPHPUnitIntegration; use MockeryPHPUnitIntegration;
protected function setUp() { protected function setUp():void {
parent::setUp(); parent::setUp();
Monkey\setUp(); Monkey\setUp();
} }
protected function tearDown() { protected function tearDown(): void {
Monkey\tearDown(); Monkey\tearDown();
parent::tearDown(); parent::tearDown();
} }
+2 -2
View File
@@ -20,8 +20,8 @@ class AssetTest extends LapsTestCase {
$manager = new Asset_Manager(); $manager = new Asset_Manager();
$this->assertTrue( has_action( 'wp_enqueue_scripts', [ $manager, 'enqueue_scripts' ] ) ); $this->assertTrue( (bool) has_action( 'wp_enqueue_scripts', [ $manager, 'enqueue_scripts' ] ) );
$this->assertTrue( has_action( 'admin_enqueue_scripts', [ $manager, 'enqueue_scripts' ] ) ); $this->assertTrue( (bool) has_action( 'admin_enqueue_scripts', [ $manager, 'enqueue_scripts' ] ) );
return $manager; return $manager;
} }
+3 -3
View File
@@ -20,8 +20,8 @@ class LoadOrderTest extends LapsTestCase {
$manager = new Load_Order_Manager(); $manager = new Load_Order_Manager();
$this->assertTrue( has_action( 'pre_update_option_active_plugins', [ $manager, 'pre_update_option_active_plugins' ] ) ); $this->assertTrue( (bool) has_action( 'pre_update_option_active_plugins', [ $manager, 'pre_update_option_active_plugins' ] ) );
$this->assertTrue( has_action( 'pre_update_site_option_active_sitewide_plugins', [ $manager, 'pre_update_option_active_plugins' ] ) ); $this->assertTrue( (bool) has_action( 'pre_update_site_option_active_sitewide_plugins', [ $manager, 'pre_update_option_active_plugins' ] ) );
return $manager; return $manager;
@@ -43,7 +43,7 @@ class LoadOrderTest extends LapsTestCase {
$plugins = $manager->pre_update_option_active_plugins( $plugins ); $plugins = $manager->pre_update_option_active_plugins( $plugins );
$this->assertInternalType( 'array', $plugins ); $this->assertIsArray( $plugins );
$this->assertCount( 3, $plugins ); $this->assertCount( 3, $plugins );
$this->assertEquals( 'laps/laps.php', $plugins[0] ); $this->assertEquals( 'laps/laps.php', $plugins[0] );
} }
+1 -1
View File
@@ -23,7 +23,7 @@ class ToolbarTest extends LapsTestCase {
$collector = new Lazy_Proxy_Collector( [] ); $collector = new Lazy_Proxy_Collector( [] );
$manager = new Toolbar_Manager( $collector, new \Mustache_Engine() ); $manager = new Toolbar_Manager( $collector, new \Mustache_Engine() );
$this->assertTrue( has_action( 'admin_bar_menu', [ $manager, 'admin_bar_menu' ] ) ); $this->assertTrue( (bool) has_action( 'admin_bar_menu', [ $manager, 'admin_bar_menu' ] ) );
return $manager; return $manager;
} }
+1 -2
View File
@@ -3,7 +3,6 @@
namespace Rarst\Laps\Tests; namespace Rarst\Laps\Tests;
use Brain\Monkey\Functions; use Brain\Monkey\Functions;
use Pimple\ServiceProviderInterface;
use Rarst\Laps\Provider\Bootable_Provider_Interface; use Rarst\Laps\Provider\Bootable_Provider_Interface;
class PluginTest extends LapsTestCase { class PluginTest extends LapsTestCase {
@@ -12,7 +11,7 @@ class PluginTest extends LapsTestCase {
$container = new \Rarst\Laps\Plugin(); $container = new \Rarst\Laps\Plugin();
$service = $this->getMockBuilder( [ ServiceProviderInterface::class, Bootable_Provider_Interface::class ] ) $service = $this->getMockBuilder( Bootable_Provider_Interface::class )
->getMock(); ->getMock();
$service->expects( $this->once() ) $service->expects( $this->once() )
+1 -1
View File
@@ -17,7 +17,7 @@ class CoreTest extends LapsTestCase {
$records = $collector->get_records(); $records = $collector->get_records();
$this->assertInternalType( 'array', $records ); $this->assertIsArray( $records );
$this->assertCount( 2, $records ); $this->assertCount( 2, $records );
$this->assertInstanceOf( Record_Interface::class, $records[0] ); $this->assertInstanceOf( Record_Interface::class, $records[0] );
} }
+2 -2
View File
@@ -18,9 +18,9 @@ class HookTest extends LapsTestCase {
$stopwatch = new Stopwatch(); $stopwatch = new Stopwatch();
$collector = new Hook_Collector( $stopwatch, [ 'core' => new Core_Events() ] ); $collector = new Hook_Collector( $stopwatch, [ 'core' => new Core_Events() ] );
$this->assertTrue( has_action( 'after_setup_theme', [ $collector, 'after_setup_theme' ] ) ); $this->assertTrue( (bool) has_action( 'after_setup_theme', [ $collector, 'after_setup_theme' ] ) );
$this->assertTrue( has_action( 'plugins_loaded', 'function ($input)' ) ); $this->assertTrue( (bool) has_action( 'plugins_loaded', 'function ($input)' ) );
$collector->after_setup_theme(); $collector->after_setup_theme();
$stopwatch->start( 'Toolbar' ); $stopwatch->start( 'Toolbar' );
+2 -2
View File
@@ -18,8 +18,8 @@ class HttpTest extends LapsTestCase {
$url = 'https://example.com/'; $url = 'https://example.com/';
$collector = new Http_Collector( $stopwatch ); $collector = new Http_Collector( $stopwatch );
$this->assertTrue( has_action( 'pre_http_request', [ $collector, 'pre_http_request' ] ) ); $this->assertTrue( (bool) has_action( 'pre_http_request', [ $collector, 'pre_http_request' ] ) );
$this->assertTrue( has_action( 'http_api_debug', [ $collector, 'http_api_debug' ] ) ); $this->assertTrue( (bool) has_action( 'http_api_debug', [ $collector, 'http_api_debug' ] ) );
$collector->pre_http_request( false, [], $url ); $collector->pre_http_request( false, [], $url );
+2 -2
View File
@@ -53,7 +53,7 @@ class IteratorTest extends LapsTestCase {
$this->assertTrue( $iterator->valid() ); $this->assertTrue( $iterator->valid() );
$records = $iterator->current(); $records = $iterator->current();
$this->assertInternalType( 'array', $records ); $this->assertIsArray( $records );
$this->assertArrayHasKey( 'description', $records[0] ); $this->assertArrayHasKey( 'description', $records[0] );
$this->assertArrayHasKey( 'category', $records[0] ); $this->assertArrayHasKey( 'category', $records[0] );
@@ -64,7 +64,7 @@ class IteratorTest extends LapsTestCase {
$this->assertTrue( $iterator->valid() ); $this->assertTrue( $iterator->valid() );
$records = $iterator->current(); $records = $iterator->current();
$this->assertInternalType( 'array', $records ); $this->assertIsArray( $records );
$iterator->next(); $iterator->next();
$this->assertFalse( $iterator->valid() ); $this->assertFalse( $iterator->valid() );
+2 -2
View File
@@ -24,8 +24,8 @@ class RecordTest extends LapsTestCase {
$this->assertEquals( $name, $record->get_name() ); $this->assertEquals( $name, $record->get_name() );
$this->assertEquals( $origin, $record->get_origin() ); $this->assertEquals( $origin, $record->get_origin() );
$this->assertEquals( $duration, $record->get_duration() ); $this->assertEquals( $duration, $record->get_duration() );
$this->assertContains( $name, $record->get_description() ); $this->assertStringContainsString( $name, $record->get_description() );
$this->assertContains( (string) ( $duration * 1000 ), $record->get_description() ); $this->assertStringContainsString( (string) ( $duration * 1000 ), $record->get_description() );
$this->assertEmpty( $record->get_category() ); $this->assertEmpty( $record->get_category() );
$record = new Record( $name, $origin, $duration, $description, $category ); $record = new Record( $name, $origin, $duration, $description, $category );
+4 -4
View File
@@ -24,7 +24,7 @@ class SqlTest extends LapsTestCase {
$collector = new Sql_Collector(); $collector = new Sql_Collector();
$this->assertTrue( has_filter( 'query', [ $collector, 'query' ] ) ); $this->assertTrue( (bool) has_filter( 'query', [ $collector, 'query' ] ) );
$query = 'SELECT * FROM wp_posts'; $query = 'SELECT * FROM wp_posts';
@@ -38,15 +38,15 @@ class SqlTest extends LapsTestCase {
$records = $collector->get_records(); $records = $collector->get_records();
$this->assertInternalType( 'array', $records ); $this->assertIsArray( $records );
$this->assertCount( 1, $records ); $this->assertCount( 1, $records );
$record = $records[0]; $record = $records[0];
$this->assertInstanceOf( Record::class, $record ); $this->assertInstanceOf( Record::class, $record );
$this->assertEquals( $query, $record->get_name() ); $this->assertEquals( $query, $record->get_name() );
$this->assertContains( $query, $record->get_description() ); $this->assertStringContainsString( $query, $record->get_description() );
$this->assertInternalType( 'float', $record->get_origin() ); $this->assertIsFloat( $record->get_origin() );
$this->assertEquals( $duration, $record->get_duration() ); $this->assertEquals( $duration, $record->get_duration() );
$this->assertEquals( 'sql-read', $record->get_category() ); $this->assertEquals( 'sql-read', $record->get_category() );
} }
+2 -2
View File
@@ -26,7 +26,7 @@ class StopwatchTest extends LapsTestCase {
$records = $collector->get_records(); $records = $collector->get_records();
$this->assertInternalType( 'array', $records ); $this->assertIsArray( $records );
$this->assertCount( 1, $records ); $this->assertCount( 1, $records );
$this->assertInstanceOf( Stopwatch_Record::class, $records[0] ); $this->assertInstanceOf( Stopwatch_Record::class, $records[0] );
@@ -47,6 +47,6 @@ class StopwatchTest extends LapsTestCase {
$this->assertEquals( 'info', $record->get_category() ); $this->assertEquals( 'info', $record->get_category() );
$this->assertEquals( $event->getOrigin() / 1000, $record->get_origin() ); $this->assertEquals( $event->getOrigin() / 1000, $record->get_origin() );
$this->assertEquals( $event->getDuration() / 1000, $record->get_duration() ); $this->assertEquals( $event->getDuration() / 1000, $record->get_duration() );
$this->assertContains( 'Event', $record->get_description() ); $this->assertStringContainsString( 'Event', $record->get_description() );
} }
} }