Merge "Don't check namespace in SpecialWantedtemplates"
[lhc/web/wiklou.git] / tests / phpunit / includes / libs / XhprofTest.php
index e0e68e0..77b188c 100644 (file)
@@ -1,6 +1,5 @@
 <?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
@@ -69,14 +68,23 @@ class XhprofTest extends PHPUnit_Framework_TestCase {
        }
 
        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;
        }
 
        /**
@@ -247,43 +255,43 @@ class XhprofTest extends PHPUnit_Framework_TestCase {
         */
        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,
@@ -303,7 +311,7 @@ class XhprofTest extends PHPUnit_Framework_TestCase {
         */
        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] );