MediaWiki  master
XhprofDataTest Class Reference
Inheritance diagram for XhprofDataTest:
Collaboration diagram for XhprofDataTest:

Public Member Functions

 provideSplitKey ()
 
 testCompleteMetricsStructure ()
 Validate the structure of data returned by Xhprof::getCompleteMetrics(). More...
 
 testCriticalPath ()
 XhprofData::getCriticalPath. More...
 
 testEdges ()
 XhprofData::getCallers XhprofData::getCallees. More...
 
 testInclude ()
 XhprofData::pruneData. More...
 
 testInclusiveMetricsStructure ()
 Validate the structure of data returned by Xhprof::getInclusiveMetrics(). More...
 
 testSplitKey ( $key, $expect)
 XhprofData::splitKey provideSplitKey. More...
 

Protected Member Functions

 assertArrayStructure ( $struct, $actual, $label=null)
 Assert that the given array has the described structure. More...
 
 getXhprofDataFixture (array $opts=[])
 Get an Xhprof instance that has been primed with a set of known testing data. More...
 

Detailed Description

Note
© 2014 Wikimedia Foundation and contributors
Since
1.25

Definition at line 25 of file XhprofDataTest.php.

Member Function Documentation

◆ assertArrayStructure()

XhprofDataTest::assertArrayStructure (   $struct,
  $actual,
  $label = null 
)
protected

Assert that the given array has the described structure.

Parameters
array$structArray of key => type mappings
array$actualArray to check
string$label

Definition at line 266 of file XhprofDataTest.php.

References $type, and as.

Referenced by testCompleteMetricsStructure(), and testInclusiveMetricsStructure().

◆ getXhprofDataFixture()

XhprofDataTest::getXhprofDataFixture ( array  $opts = [])
protected

Get an Xhprof instance that has been primed with a set of known testing data.

Tests for the Xhprof class should laregly be concerned with evaluating the manipulations of the data collected by xhprof rather than the data collection process itself.

The returned Xhprof instance primed will be with a data set created by running this trivial program using the PECL xhprof implementation:

function bar( $x ) {
if ( $x > 0 ) {
bar($x - 1);
}
}
function foo() {
for ( $idx = 0; $idx < 2; $idx++ ) {
bar( $idx );
$x = strlen( 'abc' );
}
}
xhprof_enable( XHPROF_FLAGS_CPU | XHPROF_FLAGS_MEMORY );
foo();
$x = xhprof_disable();
var_export( $x );
Returns
Xhprof

Definition at line 212 of file XhprofDataTest.php.

Referenced by testCompleteMetricsStructure(), testCriticalPath(), testEdges(), testInclude(), and testInclusiveMetricsStructure().

◆ provideSplitKey()

XhprofDataTest::provideSplitKey ( )

Definition at line 37 of file XhprofDataTest.php.

References null.

◆ testCompleteMetricsStructure()

XhprofDataTest::testCompleteMetricsStructure ( )

Validate the structure of data returned by Xhprof::getCompleteMetrics().

This acts as a guard against unexpected structural changes to the returned data in lieu of using a more heavy weight typed response object.

XhprofData::getCompleteMetrics

Definition at line 112 of file XhprofDataTest.php.

References $name, $type, as, assertArrayStructure(), and getXhprofDataFixture().

◆ testCriticalPath()

XhprofDataTest::testCriticalPath ( )

◆ testEdges()

XhprofDataTest::testEdges ( )

◆ testInclude()

XhprofDataTest::testInclude ( )

XhprofData::pruneData.

Definition at line 51 of file XhprofDataTest.php.

References getXhprofDataFixture().

◆ testInclusiveMetricsStructure()

XhprofDataTest::testInclusiveMetricsStructure ( )

Validate the structure of data returned by Xhprof::getInclusiveMetrics().

This acts as a guard against unexpected structural changes to the returned data in lieu of using a more heavy weight typed response object.

XhprofData::getInclusiveMetrics

Definition at line 70 of file XhprofDataTest.php.

References $name, $type, as, assertArrayStructure(), and getXhprofDataFixture().

◆ testSplitKey()

XhprofDataTest::testSplitKey (   $key,
  $expect 
)

XhprofData::splitKey provideSplitKey.

Definition at line 33 of file XhprofDataTest.php.

References XhprofData\splitKey().


The documentation for this class was generated from the following file: