Updated unit tests for PHPUnit 8.
This commit is contained in:
1 parent
59a17105ae
commit
739ed7dd90
13 files changed
+50
-36
No files matched your search
+4
-1
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- unit tests for PHPUnit 8
|
||||||
|
|
||||||
## 3.2 - 2019-01-30
|
## 3.2 - 2019-01-30
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
@@ -17,7 +20,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
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,14 @@ API requests need to be authenticated as admin for performance data to be sent.
|
|||||||
| -------------------------------------------------- | -------- |
|
| -------------------------------------------------- | -------- |
|
||||||
| `composer require rarst/laps` | [](https://www.rarst.net/download/laps) |
|
| `composer require rarst/laps` | [](https://www.rarst.net/download/laps) |
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
|
Tests require [Brain Monkey](https://github.com/Brain-WP/BrainMonkey) (included in dependencies) and PHPUnit 8 (not included).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
phpunit
|
||||||
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
MIT
|
MIT
|
||||||
Generated
+12
-12
@@ -4,7 +4,7 @@
|
|||||||
"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": "a72036af9e80358500e4274847500bcc",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "composer/installers",
|
"name": "composer/installers",
|
||||||
@@ -434,16 +434,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "brain/monkey",
|
"name": "brain/monkey",
|
||||||
"version": "2.2.0",
|
"version": "2.2.1",
|
||||||
"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": "326a537bf518edd61bc57ab275e8b075ebb8a1a9"
|
||||||
},
|
},
|
||||||
"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/326a537bf518edd61bc57ab275e8b075ebb8a1a9",
|
||||||
"reference": "ed9e0698bc1292f33698719da8ca1aa2e18acc51",
|
"reference": "326a537bf518edd61bc57ab275e8b075ebb8a1a9",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -494,7 +494,7 @@
|
|||||||
"test",
|
"test",
|
||||||
"testing"
|
"testing"
|
||||||
],
|
],
|
||||||
"time": "2017-12-01T16:32:09+00:00"
|
"time": "2019-03-15T13:42:24+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "hamcrest/hamcrest-php",
|
"name": "hamcrest/hamcrest-php",
|
||||||
@@ -546,16 +546,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "mockery/mockery",
|
"name": "mockery/mockery",
|
||||||
"version": "1.2.0",
|
"version": "1.2.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/mockery/mockery.git",
|
"url": "https://github.com/mockery/mockery.git",
|
||||||
"reference": "100633629bf76d57430b86b7098cd6beb996a35a"
|
"reference": "0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2"
|
||||||
},
|
},
|
||||||
"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/0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2",
|
||||||
"reference": "100633629bf76d57430b86b7098cd6beb996a35a",
|
"reference": "0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -564,7 +564,7 @@
|
|||||||
"php": ">=5.6.0"
|
"php": ">=5.6.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "~5.7.10|~6.5|~7.0"
|
"phpunit/phpunit": "~5.7.10|~6.5|~7.0|~8.0"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
@@ -607,7 +607,7 @@
|
|||||||
"test double",
|
"test double",
|
||||||
"testing"
|
"testing"
|
||||||
],
|
],
|
||||||
"time": "2018-10-02T21:52:37+00:00"
|
"time": "2019-02-13T09:37:52+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pds/skeleton",
|
"name": "pds/skeleton",
|
||||||
|
|||||||
@@ -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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,8 +50,9 @@ 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] );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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] );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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] );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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() );
|
||||||
|
|||||||
@@ -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 );
|
||||||
|
|||||||
@@ -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() );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user