Skip to content

Commit 69320d2

Browse files
committed
Adds logs.
1 parent 7ceb485 commit 69320d2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

internal/extgen/integration_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,49 +738,57 @@ func TestCallable(t *testing.T) {
738738

739739
err = suite.verifyFunctionBehavior(`<?php
740740
741+
echo "Testing my_array_map([1, 2, 3])\n";
741742
$result = my_array_map([1, 2, 3], function($x) { return $x * 2; });
742743
if ($result !== [2, 4, 6]) {
743744
echo "FAIL: my_array_map with closure expected [2, 4, 6], got " . json_encode($result);
744745
exit(1);
745746
}
746747
748+
echo "Testing my_array_map(['hello', 'world'])\n";
747749
$result = my_array_map(['hello', 'world'], 'strtoupper');
748750
if ($result !== ['HELLO', 'WORLD']) {
749751
echo "FAIL: my_array_map with function name expected ['HELLO', 'WORLD'], got " . json_encode($result);
750752
exit(1);
751753
}
752754
755+
echo "Testing my_array_map with trim function\n";
753756
$result = my_array_map([], function($x) { return $x; });
754757
if ($result !== []) {
755758
echo "FAIL: my_array_map with empty array expected [], got " . json_encode($result);
756759
exit(1);
757760
}
758761
762+
echo "Testing my_filter([1, 2, 3, 4, 5, 6])\n";
759763
$result = my_filter([1, 2, 3, 4, 5, 6], function($x) { return $x % 2 === 0; });
760764
if ($result !== [2, 4, 6]) {
761765
echo "FAIL: my_filter expected [2, 4, 6], got " . json_encode($result);
762766
exit(1);
763767
}
764768
769+
echo "Testing my_filter with null callback\n";
765770
$result = my_filter([1, 2, 3, 4], null);
766771
if ($result !== [1, 2, 3, 4]) {
767772
echo "FAIL: my_filter with null callback expected [1, 2, 3, 4], got " . json_encode($result);
768773
exit(1);
769774
}
770775
776+
echo "Testing Processor::transform\n";
771777
$processor = new Processor();
772778
$result = $processor->transform('hello', function($s) { return strtoupper($s); });
773779
if ($result !== 'HELLO') {
774780
echo "FAIL: Processor::transform with closure expected 'HELLO', got '$result'";
775781
exit(1);
776782
}
777783
784+
echo "Testing Processor::transform with function name\n";
778785
$result = $processor->transform('world', 'strtoupper');
779786
if ($result !== 'WORLD') {
780787
echo "FAIL: Processor::transform with function name expected 'WORLD', got '$result'";
781788
exit(1);
782789
}
783790
791+
echo "Testing Processor::transform with trim function\n";
784792
$result = $processor->transform(' test ', 'trim');
785793
if ($result !== 'test') {
786794
echo "FAIL: Processor::transform with trim expected 'test', got '$result'";

testdata/integration/callable.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (p *Processor) Transform(input *C.zend_string, callback *C.zval) unsafe.Poi
5858

5959
resultStr, ok := callResult.(string)
6060
if !ok {
61-
return frankenphp.PHPString(input, false)
61+
return frankenphp.PHPString(goInput, false)
6262
}
6363

6464
return frankenphp.PHPString(resultStr, false)

0 commit comments

Comments
 (0)