PATH:
opt
/
alt
/
tests
/
alt-php53-pecl-xhprof-tideways_4.1.6-2.el8
/
tests
--TEST-- Tideways: Watch with Callback --FILE-- <?php function foo_cb($context) { var_dump("inside watcher"); var_dump($context); return tideways_span_create('doctrine'); } function no_span_cb($context) { } function foo($x, $y) { } function no_span() { } function throwex_cb() { throw new \InvalidArgumentException(); } function throwex() {} function closured($x, $y) {} class Foo { private $value = 'hi!'; public function bar() {} } tideways_enable(); tideways_span_callback('foo', 'foo_cb'); tideways_span_callback('no_span', 'no_span_cb'); tideways_span_callback('throwex', 'throwex_cb'); tideways_span_callback('closured', function ($context) { echo "Inside Closure\n"; var_dump($context); }); tideways_span_callback('Foo::bar', function ($context) { echo "With Object\n"; var_dump($context); $GLOBALS['context'] = $context; }); foo(1, 2); no_span(); try { throwex_cb(); } catch (\InvalidArgumentException $e) { } closured("foo", "bar"); $foo = new Foo(); $foo->bar("baz"); echo "Context Dumped From Global State\n"; var_dump($GLOBALS['context']); tideways_disable(); echo "\nSpans\n"; var_dump(tideways_get_spans()); --EXPECTF-- string(14) "inside watcher" array(2) { ["fn"]=> string(3) "foo" ["args"]=> array(2) { [0]=> int(1) [1]=> int(2) } } Inside Closure array(2) { ["fn"]=> string(8) "closured" ["args"]=> array(2) { [0]=> string(3) "foo" [1]=> string(3) "bar" } } With Object array(3) { ["fn"]=> string(8) "Foo::bar" ["args"]=> array(1) { [0]=> string(3) "baz" } ["object"]=> object(Foo)#4 (1) { ["value":"Foo":private]=> string(3) "hi!" } } Context Dumped From Global State array(3) { ["fn"]=> string(8) "Foo::bar" ["args"]=> array(1) { [0]=> string(3) "baz" } ["object"]=> object(Foo)#4 (1) { ["value":"Foo":private]=> string(3) "hi!" } } Spans array(2) { [0]=> array(4) { ["n"]=> string(3) "app" ["b"]=> array(1) { [0]=> int(%d) } ["e"]=> array(1) { [0]=> int(%d) } ["a"]=> array(1) { ["cpu"]=> string(%d) "%d" } } [1]=> array(4) { ["n"]=> string(8) "doctrine" ["b"]=> array(1) { [0]=> int(%d) } ["e"]=> array(1) { [0]=> int(%d) } ["a"]=> array(1) { ["fn"]=> string(%d) "foo" } } }
[-] tideways_events2.php
[edit]
[-] tideways_spans_032.phpt
[edit]
[-] tideways_003.phpt
[edit]
[-] tideways_spans_022.phpt
[edit]
[-] tideways_036.phpt
[edit]
[-] tideways_spans_014.phpt
[edit]
[-] tideways_spans_017.phpt
[edit]
[-] tideways_tranaction_cakephp3.phpt
[edit]
[-] tideways_errors_004.phpt
[edit]
[-] tideways_spans_019.phpt
[edit]
[-] common_predis.php
[edit]
[-] tideways_007.phpt
[edit]
[-] tideways_errors_002.phpt
[edit]
[-] tideways_spans_027.phpt
[edit]
[-] tideways_005.phpt
[edit]
[-] tideways_spans_025.phpt
[edit]
[-] tideways_spans_018.phpt
[edit]
[-] tideways_events1.php
[edit]
[-] tideways_spans_021.phpt
[edit]
[-] tideways_038.phpt
[edit]
[-] tideways_spans_020.phpt
[edit]
[-] memleak.phpt
[edit]
[-] tideways_023_classes.php
[edit]
[-] tideways_018.phpt
[edit]
[-] http_responder.php
[edit]
[-] tideways_037.phpt
[edit]
[-] tideways_fw_magento_001.phpt
[edit]
[-] tideways_spans_004.phpt
[edit]
[-] tideways_spans_005.phpt
[edit]
[-] tideways_spans_003.phpt
[edit]
[-] tideways_fw_wordpress_001.phpt
[edit]
[-] tideways_spans_007.phpt
[edit]
[-] tideways_039.phpt
[edit]
[-] tideways_spans_030.phpt
[edit]
[-] tideways_spans_031.phpt
[edit]
[-] tideways_004_inc.php
[edit]
[-] tideways_spans_013.phpt
[edit]
[-] tideways_spans_016.phpt
[edit]
[-] tideways_sql_001.phpt
[edit]
[-] tideways_040.phpt
[edit]
[-] tideways_spans_035.phpt
[edit]
[-] tideways_fw_symfony_002.phpt
[edit]
[-] tideways_fw_shopware_001.phpt
[edit]
[-] tideways_spans_015.phpt
[edit]
[-] tideways_001.phpt
[edit]
[-] tideways_spans_024.phpt
[edit]
[-] tideways_spans_026.phpt
[edit]
[-] tideways_doctrine.php
[edit]
[-] tideways_009.phpt
[edit]
[-] tideways_tranaction_cakephp2.phpt
[edit]
[-] tideways_spans_023.phpt
[edit]
[-] tideways_spans_001.phpt
[edit]
[-] tideways_024.phpt
[edit]
[-] tideways_023.phpt
[edit]
[-] tideways_fw_options.phpt
[edit]
[-] tideways_spans_002.phpt
[edit]
[-] tideways_queue.php
[edit]
[-] tideways_symfony3.php
[edit]
[-] tideways_spans_036.phpt
[edit]
[-] tideways_029.phpt
[edit]
[-] tideways_spans_028.phpt
[edit]
[-] tideways_transaction_yii.phpt
[edit]
[-] tideways_004.phpt
[edit]
[-] tideways_spans_012.phpt
[edit]
[-] tideways_026.phpt
[edit]
[-] tideways_002.phpt
[edit]
[-] tideways_004_require.php
[edit]
[-] tideways_symfony.php
[edit]
[-] tideways_errors_005.phpt
[edit]
[-] tideways_spans_006.phpt
[edit]
[-] tideways_errors_001.phpt
[edit]
[+]
..
[-] tideways_spans_008.phpt
[edit]
[-] tideways_039_prepend.php
[edit]
[-] tideways_fw_oxid_001.phpt
[edit]
[-] tideways_spans_009.phpt
[edit]
[-] tideways_errors_003.phpt
[edit]
[-] common.php
[edit]
[-] tideways_035.phpt
[edit]
[-] tideways_spans_029.phpt
[edit]
[-] tideways_fw_zend1.phpt
[edit]
[-] elasticsearch.php
[edit]
[-] tideways_transaction_yii2.phpt
[edit]