<?php
/**
- * @section LICENSE
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
}
public function provideRawData() {
- return array(
+ $tests = array(
array( 0, array( 'ct', 'wt' ) ),
- array( XHPROF_FLAGS_MEMORY, array( 'ct', 'wt', 'mu', 'pmu' ) ),
- array( XHPROF_FLAGS_CPU, array( 'ct', 'wt', 'cpu' ) ),
- array( XHPROF_FLAGS_MEMORY | XHPROF_FLAGS_CPU, array(
- 'ct', 'wt', 'mu', 'pmu', 'cpu',
- ) ),
);
+
+ if ( defined( 'XHPROF_FLAGS_CPU' ) && defined( 'XHPROF_FLAGS_CPU' ) ) {
+ $tests[] = array( XHPROF_FLAGS_MEMORY, array(
+ 'ct', 'wt', 'mu', 'pmu',
+ ) );
+ $tests[] = array( XHPROF_FLAGS_CPU, array(
+ 'ct', 'wt', 'cpu',
+ ) );
+ $tests[] = array( XHPROF_FLAGS_MEMORY | XHPROF_FLAGS_CPU, array(
+ 'ct', 'wt', 'mu', 'pmu', 'cpu',
+ ) );
+ }
+
+ return $tests;
}
/**
*/
protected function getXhprofFixture( array $opts = array() ) {
$xhprof = new Xhprof( $opts );
- $xhprof->loadRawData( array (
- 'foo==>bar' => array (
+ $xhprof->loadRawData( array(
+ 'foo==>bar' => array(
'ct' => 2,
'wt' => 57,
'cpu' => 92,
'mu' => 1896,
'pmu' => 0,
),
- 'foo==>strlen' => array (
+ 'foo==>strlen' => array(
'ct' => 2,
'wt' => 21,
'cpu' => 141,
'mu' => 752,
'pmu' => 0,
),
- 'bar==>bar@1' => array (
+ 'bar==>bar@1' => array(
'ct' => 1,
'wt' => 18,
'cpu' => 19,
'mu' => 752,
'pmu' => 0,
),
- 'main()==>foo' => array (
+ 'main()==>foo' => array(
'ct' => 1,
'wt' => 304,
'cpu' => 307,
'mu' => 4008,
'pmu' => 0,
),
- 'main()==>xhprof_disable' => array (
+ 'main()==>xhprof_disable' => array(
'ct' => 1,
'wt' => 8,
'cpu' => 10,
'mu' => 768,
'pmu' => 392,
),
- 'main()' => array (
+ 'main()' => array(
'ct' => 1,
'wt' => 353,
'cpu' => 351,
*/
protected function assertArrayStructure( $struct, $actual, $label = null ) {
$this->assertInternalType( 'array', $actual, $label );
- $this->assertCount( count($struct), $actual, $label );
+ $this->assertCount( count( $struct ), $actual, $label );
foreach ( $struct as $key => $type ) {
$this->assertArrayHasKey( $key, $actual );
$this->assertInternalType( $type, $actual[$key] );