(t *testing.T)
| 643 | } |
| 644 | |
| 645 | func TestParameterParser_Integration(t *testing.T) { |
| 646 | pp := &ParameterParser{} |
| 647 | |
| 648 | params := []phpParameter{ |
| 649 | {Name: "name", PhpType: phpString, HasDefault: false}, |
| 650 | {Name: "count", PhpType: phpInt, HasDefault: true, DefaultValue: "10"}, |
| 651 | {Name: "enabled", PhpType: phpBool, HasDefault: true, DefaultValue: "true"}, |
| 652 | } |
| 653 | |
| 654 | info := pp.analyzeParameters(params) |
| 655 | assert.Equal(t, 1, info.RequiredCount) |
| 656 | assert.Equal(t, 3, info.TotalCount) |
| 657 | |
| 658 | declarations := pp.generateParamDeclarations(params) |
| 659 | expectedDeclarations := []string{ |
| 660 | "zend_string *name = NULL;", |
| 661 | "zend_long count = 10;", |
| 662 | "zend_bool enabled = 1;", |
| 663 | } |
| 664 | for _, expected := range expectedDeclarations { |
| 665 | assert.Contains(t, declarations, expected) |
| 666 | } |
| 667 | |
| 668 | parsing := pp.generateParamParsing(params, info.RequiredCount) |
| 669 | assert.Contains(t, parsing, "ZEND_PARSE_PARAMETERS_START(1, 3)") |
| 670 | assert.Contains(t, parsing, "Z_PARAM_OPTIONAL") |
| 671 | |
| 672 | goCallParams := pp.generateGoCallParams(params) |
| 673 | assert.Equal(t, "name, (long) count, (int) enabled", goCallParams) |
| 674 | } |
nothing calls this directly
no test coverage detected