@@ -214,7 +214,7 @@ |
||
214 | 214 | while (false !== strpos($sb, '${')) { |
215 | 215 | $sb = preg_replace_callback( |
216 | 216 | '/\$\{([^\$}]+)\}/', |
217 | - function ($matches) use ($keys) { |
|
217 | + function($matches) use ($keys) { |
|
218 | 218 | $propertyName = $matches[1]; |
219 | 219 | |
220 | 220 | $replacement = null; |
@@ -342,7 +342,7 @@ |
||
342 | 342 | public static function formatTime(float $seconds): string |
343 | 343 | { |
344 | 344 | /** @var float|int $number */ |
345 | - $getPlural = function ($number): string { |
|
345 | + $getPlural = function($number): string { |
|
346 | 346 | return 1 == $number ? '' : 's'; |
347 | 347 | }; |
348 | 348 | $chunks = []; |
@@ -57,19 +57,3 @@ |
||
57 | 57 | |
58 | 58 | $this->builder->build($task); |
59 | 59 | $expectedCommand = <<< 'CMD' |
60 | - Executing 'phpstan' with arguments: |
|
61 | - 'analyse' |
|
62 | - '--configuration=anyConfiguration' |
|
63 | - '--level=anyLevel' |
|
64 | - '--no-progress' |
|
65 | - '--debug' |
|
66 | - '--autoload-file=anyAutoloadFile' |
|
67 | - '--error-format=anyErrorFormat' |
|
68 | - '--memory-limit=anyMemoryLimit' |
|
69 | - 'path1 path2' |
|
70 | - The ' characters around the executable and arguments are not part of the command. |
|
71 | - CMD; |
|
72 | - |
|
73 | - $this->assertEquals($expectedCommand, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
74 | - } |
|
75 | -} |
@@ -57,19 +57,3 @@ |
||
57 | 57 | |
58 | 58 | $this->builder->build($task); |
59 | 59 | $expectedCommand = <<< 'CMD' |
60 | - Executing 'phpstan' with arguments: |
|
61 | - 'analyse' |
|
62 | - '--configuration=anyConfiguration' |
|
63 | - '--level=anyLevel' |
|
64 | - '--no-progress' |
|
65 | - '--debug' |
|
66 | - '--autoload-file=anyAutoloadFile' |
|
67 | - '--error-format=anyErrorFormat' |
|
68 | - '--memory-limit=anyMemoryLimit' |
|
69 | - 'path1 path2' |
|
70 | - The ' characters around the executable and arguments are not part of the command. |
|
71 | - CMD; |
|
72 | - |
|
73 | - $this->assertEquals($expectedCommand, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
74 | - } |
|
75 | -} |
@@ -57,19 +57,3 @@ |
||
57 | 57 | |
58 | 58 | $this->builder->build($task); |
59 | 59 | $expectedCommand = <<< 'CMD' |
60 | - Executing 'phpstan' with arguments: |
|
61 | - 'analyse' |
|
62 | - '--configuration=anyConfiguration' |
|
63 | - '--level=anyLevel' |
|
64 | - '--no-progress' |
|
65 | - '--debug' |
|
66 | - '--autoload-file=anyAutoloadFile' |
|
67 | - '--error-format=anyErrorFormat' |
|
68 | - '--memory-limit=anyMemoryLimit' |
|
69 | - 'path1 path2' |
|
70 | - The ' characters around the executable and arguments are not part of the command. |
|
71 | - CMD; |
|
72 | - |
|
73 | - $this->assertEquals($expectedCommand, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
74 | - } |
|
75 | -} |
@@ -57,19 +57,3 @@ |
||
57 | 57 | |
58 | 58 | $this->builder->build($task); |
59 | 59 | $expectedCommand = <<< 'CMD' |
60 | - Executing 'phpstan' with arguments: |
|
61 | - 'analyse' |
|
62 | - '--configuration=anyConfiguration' |
|
63 | - '--level=anyLevel' |
|
64 | - '--no-progress' |
|
65 | - '--debug' |
|
66 | - '--autoload-file=anyAutoloadFile' |
|
67 | - '--error-format=anyErrorFormat' |
|
68 | - '--memory-limit=anyMemoryLimit' |
|
69 | - 'path1 path2' |
|
70 | - The ' characters around the executable and arguments are not part of the command. |
|
71 | - CMD; |
|
72 | - |
|
73 | - $this->assertEquals($expectedCommand, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
74 | - } |
|
75 | -} |
@@ -57,19 +57,3 @@ |
||
57 | 57 | |
58 | 58 | $this->builder->build($task); |
59 | 59 | $expectedCommand = <<< 'CMD' |
60 | - Executing 'phpstan' with arguments: |
|
61 | - 'analyse' |
|
62 | - '--configuration=anyConfiguration' |
|
63 | - '--level=anyLevel' |
|
64 | - '--no-progress' |
|
65 | - '--debug' |
|
66 | - '--autoload-file=anyAutoloadFile' |
|
67 | - '--error-format=anyErrorFormat' |
|
68 | - '--memory-limit=anyMemoryLimit' |
|
69 | - 'path1 path2' |
|
70 | - The ' characters around the executable and arguments are not part of the command. |
|
71 | - CMD; |
|
72 | - |
|
73 | - $this->assertEquals($expectedCommand, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
74 | - } |
|
75 | -} |
@@ -49,53 +49,3 @@ |
||
49 | 49 | $this->builder->build($task); |
50 | 50 | |
51 | 51 | $cmd = <<<'CMD' |
52 | - Executing 'anyExecutable' with arguments: |
|
53 | - 'anyCommand' |
|
54 | - The ' characters around the executable and arguments are not part of the command. |
|
55 | - CMD; |
|
56 | - |
|
57 | - $this->assertEquals($cmd, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
58 | - } |
|
59 | - |
|
60 | - public function testItFailsWhenExecutableNotSet(): void |
|
61 | - { |
|
62 | - $task = new PHPStanTask(); |
|
63 | - $task->setExecutable(''); |
|
64 | - |
|
65 | - $this->expectException(BuildException::class); |
|
66 | - |
|
67 | - $this->builder->build($task); |
|
68 | - } |
|
69 | - |
|
70 | - public function testItHandlesCommonOptions(): void |
|
71 | - { |
|
72 | - $task = new PHPStanTask(); |
|
73 | - $task->setExecutable('anyExecutable'); |
|
74 | - $task->setCommand('anyCommand'); |
|
75 | - |
|
76 | - $task->setHelp(true); |
|
77 | - $task->setQuiet(true); |
|
78 | - $task->setVersion(true); |
|
79 | - $task->setANSI(true); |
|
80 | - $task->setNoANSI(true); |
|
81 | - $task->setNoInteraction(true); |
|
82 | - $task->setVerbose(true); |
|
83 | - |
|
84 | - $this->builder->build($task); |
|
85 | - |
|
86 | - $expectedCommand = <<<'CMD' |
|
87 | - Executing 'anyExecutable' with arguments: |
|
88 | - 'anyCommand' |
|
89 | - '--help' |
|
90 | - '--quiet' |
|
91 | - '--version' |
|
92 | - '--ansi' |
|
93 | - '--no-ansi' |
|
94 | - '--no-interaction' |
|
95 | - '--verbose' |
|
96 | - The ' characters around the executable and arguments are not part of the command. |
|
97 | - CMD; |
|
98 | - |
|
99 | - $this->assertEquals($expectedCommand, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
100 | - } |
|
101 | -} |
@@ -49,53 +49,3 @@ |
||
49 | 49 | $this->builder->build($task); |
50 | 50 | |
51 | 51 | $cmd = <<<'CMD' |
52 | - Executing 'anyExecutable' with arguments: |
|
53 | - 'anyCommand' |
|
54 | - The ' characters around the executable and arguments are not part of the command. |
|
55 | - CMD; |
|
56 | - |
|
57 | - $this->assertEquals($cmd, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
58 | - } |
|
59 | - |
|
60 | - public function testItFailsWhenExecutableNotSet(): void |
|
61 | - { |
|
62 | - $task = new PHPStanTask(); |
|
63 | - $task->setExecutable(''); |
|
64 | - |
|
65 | - $this->expectException(BuildException::class); |
|
66 | - |
|
67 | - $this->builder->build($task); |
|
68 | - } |
|
69 | - |
|
70 | - public function testItHandlesCommonOptions(): void |
|
71 | - { |
|
72 | - $task = new PHPStanTask(); |
|
73 | - $task->setExecutable('anyExecutable'); |
|
74 | - $task->setCommand('anyCommand'); |
|
75 | - |
|
76 | - $task->setHelp(true); |
|
77 | - $task->setQuiet(true); |
|
78 | - $task->setVersion(true); |
|
79 | - $task->setANSI(true); |
|
80 | - $task->setNoANSI(true); |
|
81 | - $task->setNoInteraction(true); |
|
82 | - $task->setVerbose(true); |
|
83 | - |
|
84 | - $this->builder->build($task); |
|
85 | - |
|
86 | - $expectedCommand = <<<'CMD' |
|
87 | - Executing 'anyExecutable' with arguments: |
|
88 | - 'anyCommand' |
|
89 | - '--help' |
|
90 | - '--quiet' |
|
91 | - '--version' |
|
92 | - '--ansi' |
|
93 | - '--no-ansi' |
|
94 | - '--no-interaction' |
|
95 | - '--verbose' |
|
96 | - The ' characters around the executable and arguments are not part of the command. |
|
97 | - CMD; |
|
98 | - |
|
99 | - $this->assertEquals($expectedCommand, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
100 | - } |
|
101 | -} |
@@ -49,53 +49,3 @@ |
||
49 | 49 | $this->builder->build($task); |
50 | 50 | |
51 | 51 | $cmd = <<<'CMD' |
52 | - Executing 'anyExecutable' with arguments: |
|
53 | - 'anyCommand' |
|
54 | - The ' characters around the executable and arguments are not part of the command. |
|
55 | - CMD; |
|
56 | - |
|
57 | - $this->assertEquals($cmd, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
58 | - } |
|
59 | - |
|
60 | - public function testItFailsWhenExecutableNotSet(): void |
|
61 | - { |
|
62 | - $task = new PHPStanTask(); |
|
63 | - $task->setExecutable(''); |
|
64 | - |
|
65 | - $this->expectException(BuildException::class); |
|
66 | - |
|
67 | - $this->builder->build($task); |
|
68 | - } |
|
69 | - |
|
70 | - public function testItHandlesCommonOptions(): void |
|
71 | - { |
|
72 | - $task = new PHPStanTask(); |
|
73 | - $task->setExecutable('anyExecutable'); |
|
74 | - $task->setCommand('anyCommand'); |
|
75 | - |
|
76 | - $task->setHelp(true); |
|
77 | - $task->setQuiet(true); |
|
78 | - $task->setVersion(true); |
|
79 | - $task->setANSI(true); |
|
80 | - $task->setNoANSI(true); |
|
81 | - $task->setNoInteraction(true); |
|
82 | - $task->setVerbose(true); |
|
83 | - |
|
84 | - $this->builder->build($task); |
|
85 | - |
|
86 | - $expectedCommand = <<<'CMD' |
|
87 | - Executing 'anyExecutable' with arguments: |
|
88 | - 'anyCommand' |
|
89 | - '--help' |
|
90 | - '--quiet' |
|
91 | - '--version' |
|
92 | - '--ansi' |
|
93 | - '--no-ansi' |
|
94 | - '--no-interaction' |
|
95 | - '--verbose' |
|
96 | - The ' characters around the executable and arguments are not part of the command. |
|
97 | - CMD; |
|
98 | - |
|
99 | - $this->assertEquals($expectedCommand, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
100 | - } |
|
101 | -} |
@@ -49,53 +49,3 @@ |
||
49 | 49 | $this->builder->build($task); |
50 | 50 | |
51 | 51 | $cmd = <<<'CMD' |
52 | - Executing 'anyExecutable' with arguments: |
|
53 | - 'anyCommand' |
|
54 | - The ' characters around the executable and arguments are not part of the command. |
|
55 | - CMD; |
|
56 | - |
|
57 | - $this->assertEquals($cmd, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
58 | - } |
|
59 | - |
|
60 | - public function testItFailsWhenExecutableNotSet(): void |
|
61 | - { |
|
62 | - $task = new PHPStanTask(); |
|
63 | - $task->setExecutable(''); |
|
64 | - |
|
65 | - $this->expectException(BuildException::class); |
|
66 | - |
|
67 | - $this->builder->build($task); |
|
68 | - } |
|
69 | - |
|
70 | - public function testItHandlesCommonOptions(): void |
|
71 | - { |
|
72 | - $task = new PHPStanTask(); |
|
73 | - $task->setExecutable('anyExecutable'); |
|
74 | - $task->setCommand('anyCommand'); |
|
75 | - |
|
76 | - $task->setHelp(true); |
|
77 | - $task->setQuiet(true); |
|
78 | - $task->setVersion(true); |
|
79 | - $task->setANSI(true); |
|
80 | - $task->setNoANSI(true); |
|
81 | - $task->setNoInteraction(true); |
|
82 | - $task->setVerbose(true); |
|
83 | - |
|
84 | - $this->builder->build($task); |
|
85 | - |
|
86 | - $expectedCommand = <<<'CMD' |
|
87 | - Executing 'anyExecutable' with arguments: |
|
88 | - 'anyCommand' |
|
89 | - '--help' |
|
90 | - '--quiet' |
|
91 | - '--version' |
|
92 | - '--ansi' |
|
93 | - '--no-ansi' |
|
94 | - '--no-interaction' |
|
95 | - '--verbose' |
|
96 | - The ' characters around the executable and arguments are not part of the command. |
|
97 | - CMD; |
|
98 | - |
|
99 | - $this->assertEquals($expectedCommand, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
100 | - } |
|
101 | -} |
@@ -49,53 +49,3 @@ |
||
49 | 49 | $this->builder->build($task); |
50 | 50 | |
51 | 51 | $cmd = <<<'CMD' |
52 | - Executing 'anyExecutable' with arguments: |
|
53 | - 'anyCommand' |
|
54 | - The ' characters around the executable and arguments are not part of the command. |
|
55 | - CMD; |
|
56 | - |
|
57 | - $this->assertEquals($cmd, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
58 | - } |
|
59 | - |
|
60 | - public function testItFailsWhenExecutableNotSet(): void |
|
61 | - { |
|
62 | - $task = new PHPStanTask(); |
|
63 | - $task->setExecutable(''); |
|
64 | - |
|
65 | - $this->expectException(BuildException::class); |
|
66 | - |
|
67 | - $this->builder->build($task); |
|
68 | - } |
|
69 | - |
|
70 | - public function testItHandlesCommonOptions(): void |
|
71 | - { |
|
72 | - $task = new PHPStanTask(); |
|
73 | - $task->setExecutable('anyExecutable'); |
|
74 | - $task->setCommand('anyCommand'); |
|
75 | - |
|
76 | - $task->setHelp(true); |
|
77 | - $task->setQuiet(true); |
|
78 | - $task->setVersion(true); |
|
79 | - $task->setANSI(true); |
|
80 | - $task->setNoANSI(true); |
|
81 | - $task->setNoInteraction(true); |
|
82 | - $task->setVerbose(true); |
|
83 | - |
|
84 | - $this->builder->build($task); |
|
85 | - |
|
86 | - $expectedCommand = <<<'CMD' |
|
87 | - Executing 'anyExecutable' with arguments: |
|
88 | - 'anyCommand' |
|
89 | - '--help' |
|
90 | - '--quiet' |
|
91 | - '--version' |
|
92 | - '--ansi' |
|
93 | - '--no-ansi' |
|
94 | - '--no-interaction' |
|
95 | - '--verbose' |
|
96 | - The ' characters around the executable and arguments are not part of the command. |
|
97 | - CMD; |
|
98 | - |
|
99 | - $this->assertEquals($expectedCommand, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
100 | - } |
|
101 | -} |
@@ -53,14 +53,3 @@ |
||
53 | 53 | $this->builder->build($task); |
54 | 54 | |
55 | 55 | $expectedCommand = <<<'CMD' |
56 | - Executing 'phpstan' with arguments: |
|
57 | - 'list' |
|
58 | - '--format=anyFormat' |
|
59 | - '--raw' |
|
60 | - 'anyNamespace' |
|
61 | - The ' characters around the executable and arguments are not part of the command. |
|
62 | - CMD; |
|
63 | - |
|
64 | - $this->assertEquals($expectedCommand, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
65 | - } |
|
66 | -} |
@@ -53,14 +53,3 @@ |
||
53 | 53 | $this->builder->build($task); |
54 | 54 | |
55 | 55 | $expectedCommand = <<<'CMD' |
56 | - Executing 'phpstan' with arguments: |
|
57 | - 'list' |
|
58 | - '--format=anyFormat' |
|
59 | - '--raw' |
|
60 | - 'anyNamespace' |
|
61 | - The ' characters around the executable and arguments are not part of the command. |
|
62 | - CMD; |
|
63 | - |
|
64 | - $this->assertEquals($expectedCommand, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
65 | - } |
|
66 | -} |
@@ -53,14 +53,3 @@ |
||
53 | 53 | $this->builder->build($task); |
54 | 54 | |
55 | 55 | $expectedCommand = <<<'CMD' |
56 | - Executing 'phpstan' with arguments: |
|
57 | - 'list' |
|
58 | - '--format=anyFormat' |
|
59 | - '--raw' |
|
60 | - 'anyNamespace' |
|
61 | - The ' characters around the executable and arguments are not part of the command. |
|
62 | - CMD; |
|
63 | - |
|
64 | - $this->assertEquals($expectedCommand, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
65 | - } |
|
66 | -} |
@@ -53,14 +53,3 @@ |
||
53 | 53 | $this->builder->build($task); |
54 | 54 | |
55 | 55 | $expectedCommand = <<<'CMD' |
56 | - Executing 'phpstan' with arguments: |
|
57 | - 'list' |
|
58 | - '--format=anyFormat' |
|
59 | - '--raw' |
|
60 | - 'anyNamespace' |
|
61 | - The ' characters around the executable and arguments are not part of the command. |
|
62 | - CMD; |
|
63 | - |
|
64 | - $this->assertEquals($expectedCommand, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
65 | - } |
|
66 | -} |
@@ -53,14 +53,3 @@ |
||
53 | 53 | $this->builder->build($task); |
54 | 54 | |
55 | 55 | $expectedCommand = <<<'CMD' |
56 | - Executing 'phpstan' with arguments: |
|
57 | - 'list' |
|
58 | - '--format=anyFormat' |
|
59 | - '--raw' |
|
60 | - 'anyNamespace' |
|
61 | - The ' characters around the executable and arguments are not part of the command. |
|
62 | - CMD; |
|
63 | - |
|
64 | - $this->assertEquals($expectedCommand, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
65 | - } |
|
66 | -} |
@@ -53,14 +53,3 @@ |
||
53 | 53 | $this->builder->build($task); |
54 | 54 | |
55 | 55 | $expectedCommand = <<<'CMD' |
56 | - Executing 'phpstan' with arguments: |
|
57 | - 'help' |
|
58 | - '--format=anyFormat' |
|
59 | - '--raw' |
|
60 | - 'anyCommand' |
|
61 | - The ' characters around the executable and arguments are not part of the command. |
|
62 | - CMD; |
|
63 | - |
|
64 | - $this->assertEquals($expectedCommand, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
65 | - } |
|
66 | -} |
@@ -53,14 +53,3 @@ |
||
53 | 53 | $this->builder->build($task); |
54 | 54 | |
55 | 55 | $expectedCommand = <<<'CMD' |
56 | - Executing 'phpstan' with arguments: |
|
57 | - 'help' |
|
58 | - '--format=anyFormat' |
|
59 | - '--raw' |
|
60 | - 'anyCommand' |
|
61 | - The ' characters around the executable and arguments are not part of the command. |
|
62 | - CMD; |
|
63 | - |
|
64 | - $this->assertEquals($expectedCommand, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
65 | - } |
|
66 | -} |
@@ -53,14 +53,3 @@ |
||
53 | 53 | $this->builder->build($task); |
54 | 54 | |
55 | 55 | $expectedCommand = <<<'CMD' |
56 | - Executing 'phpstan' with arguments: |
|
57 | - 'help' |
|
58 | - '--format=anyFormat' |
|
59 | - '--raw' |
|
60 | - 'anyCommand' |
|
61 | - The ' characters around the executable and arguments are not part of the command. |
|
62 | - CMD; |
|
63 | - |
|
64 | - $this->assertEquals($expectedCommand, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
65 | - } |
|
66 | -} |
@@ -53,14 +53,3 @@ |
||
53 | 53 | $this->builder->build($task); |
54 | 54 | |
55 | 55 | $expectedCommand = <<<'CMD' |
56 | - Executing 'phpstan' with arguments: |
|
57 | - 'help' |
|
58 | - '--format=anyFormat' |
|
59 | - '--raw' |
|
60 | - 'anyCommand' |
|
61 | - The ' characters around the executable and arguments are not part of the command. |
|
62 | - CMD; |
|
63 | - |
|
64 | - $this->assertEquals($expectedCommand, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
65 | - } |
|
66 | -} |
@@ -53,14 +53,3 @@ |
||
53 | 53 | $this->builder->build($task); |
54 | 54 | |
55 | 55 | $expectedCommand = <<<'CMD' |
56 | - Executing 'phpstan' with arguments: |
|
57 | - 'help' |
|
58 | - '--format=anyFormat' |
|
59 | - '--raw' |
|
60 | - 'anyCommand' |
|
61 | - The ' characters around the executable and arguments are not part of the command. |
|
62 | - CMD; |
|
63 | - |
|
64 | - $this->assertEquals($expectedCommand, str_replace("\r", '', $task->getCommandline()->describeCommand())); |
|
65 | - } |
|
66 | -} |
@@ -70,144 +70,3 @@ |
||
70 | 70 | // for some reason default splitter mangles spaces on subsequent lines |
71 | 71 | $expected = [ |
72 | 72 | <<<'SQL' |
73 | - insert into foo (bar, "strange;name""indeed") values ('bar''s value containing ;', 'a value for strange named column') |
|
74 | - SQL, |
|
75 | - <<<'SQL' |
|
76 | - delete |
|
77 | - from |
|
78 | - foo where bar = 'some value' |
|
79 | - SQL, |
|
80 | - <<<'SQL' |
|
81 | - update dump -- I should not be ignored |
|
82 | - set message = 'I am a string with \\ backslash \' escapes and semicolons;' |
|
83 | - SQL, |
|
84 | - <<<'SQL' |
|
85 | - create procedure setfoo(newfoo int) |
|
86 | - begin |
|
87 | - set @foo = newfoo; |
|
88 | - end |
|
89 | - SQL, |
|
90 | - <<<'SQL' |
|
91 | - insert into dump (message) values ('I am a statement not ending with a delimiter') |
|
92 | - SQL, |
|
93 | - ]; |
|
94 | - // and insists on "\n" linebreaks |
|
95 | - foreach ($expected as &$query) { |
|
96 | - $query = str_replace(["\n\n", "\r"], ["\n", ''], $query); |
|
97 | - } |
|
98 | - |
|
99 | - $this->mockTask->setSrc(new File(PHING_TEST_BASE . '/etc/tasks/ext/pdo/delimiters-normal.sql')); |
|
100 | - $this->mockTask->setDelimiterType(PDOSQLExecTask::DELIM_NORMAL); |
|
101 | - $this->project->setProperty('bar.value', 'some value'); |
|
102 | - $this->project->executeTarget('test'); |
|
103 | - |
|
104 | - $this->assertEquals($expected, $this->queries); |
|
105 | - } |
|
106 | - |
|
107 | - public function testDelimiterTypeRow() |
|
108 | - { |
|
109 | - // for some reason default splitter mangles spaces on subsequent lines |
|
110 | - $expected = [ |
|
111 | - <<<'SQL' |
|
112 | - insert into "duh" (foo) values ('duh') |
|
113 | - SQL, |
|
114 | - <<<'SQL' |
|
115 | - update "duh?" -- I should not be ignored |
|
116 | - set foo = 'some value' |
|
117 | - SQL, |
|
118 | - <<<'SQL' |
|
119 | - insert into dump (message) values ('I am a statement not ending with a delimiter') |
|
120 | - SQL, |
|
121 | - ]; |
|
122 | - // and insists on "\n" linebreaks |
|
123 | - foreach ($expected as &$query) { |
|
124 | - $query = str_replace(["\n\n", "\r"], ["\n", ''], $query); |
|
125 | - } |
|
126 | - |
|
127 | - $this->mockTask->setSrc(new File(PHING_TEST_BASE . '/etc/tasks/ext/pdo/delimiters-row.sql')); |
|
128 | - $this->mockTask->setDelimiterType(PDOSQLExecTask::DELIM_ROW); |
|
129 | - $this->mockTask->setDelimiter('duh'); |
|
130 | - $this->project->setProperty('foo.value', 'some value'); |
|
131 | - $this->project->executeTarget('test'); |
|
132 | - |
|
133 | - $this->assertEquals($expected, $this->queries); |
|
134 | - } |
|
135 | - |
|
136 | - /** |
|
137 | - * Checks that PDOSQLExecTask properly understands PostgreSQL dialect |
|
138 | - * (especially "dollar quoting") when working with 'pgsql:' URLs. |
|
139 | - * |
|
140 | - * @see http://www.phing.info/trac/ticket/499 |
|
141 | - * @see http://www.postgresql.org/docs/9.0/interactive/sql-syntax-lexical.html#SQL-SYNTAX-DOLLAR-QUOTING |
|
142 | - */ |
|
143 | - public function testRequest499() |
|
144 | - { |
|
145 | - $expected = [ |
|
146 | - <<<'SQL' |
|
147 | - select 1 |
|
148 | - # 2 |
|
149 | - SQL, |
|
150 | - <<<'SQL' |
|
151 | - select 'foo' |
|
152 | - // 'bar' |
|
153 | - SQL, |
|
154 | - <<<'SQL' |
|
155 | - insert into foo (bar, "strange;name""indeed") values ('bar''s value containing ;', 'a value for strange named column') |
|
156 | - SQL, |
|
157 | - <<<'SQL' |
|
158 | - create function foo(text) |
|
159 | - returns boolean as |
|
160 | - $function$ |
|
161 | - BEGIN |
|
162 | - RETURN ($1 ~ $q$[\t\r\n\v\\]$q$); |
|
163 | - END; |
|
164 | - $function$ |
|
165 | - language plpgsql |
|
166 | - SQL, |
|
167 | - <<<'SQL' |
|
168 | - CREATE FUNCTION phingPDOtest() RETURNS "trigger" |
|
169 | - AS $_X$ |
|
170 | - if (1) |
|
171 | - { |
|
172 | - # All is well - just continue |
|
173 | - |
|
174 | - return; |
|
175 | - } |
|
176 | - else |
|
177 | - { |
|
178 | - # Not good - this is probably a fatal error! |
|
179 | - elog(ERROR,"True is not true"); |
|
180 | - |
|
181 | - return "SKIP"; |
|
182 | - } |
|
183 | - $_X$ |
|
184 | - LANGUAGE plperl |
|
185 | - SQL, |
|
186 | - "insert into foo (bar) \nvalues ('some value')", |
|
187 | - <<<'SQL' |
|
188 | - insert into foo (bar) values ($$ a dollar-quoted string containing a few quotes ' ", a $placeholder$ and a semicolon;$$) |
|
189 | - SQL, |
|
190 | - <<<'SQL' |
|
191 | - create rule blah_insert |
|
192 | - as on insert to blah do instead ( |
|
193 | - insert into foo values (new.id, 'blah'); |
|
194 | - insert into bar values (new.id, 'blah-blah'); |
|
195 | - ) |
|
196 | - SQL, |
|
197 | - <<<'SQL' |
|
198 | - insert into dump (message) values ('I am a statement not ending with a delimiter') |
|
199 | - SQL, |
|
200 | - ]; |
|
201 | - foreach ($expected as &$query) { |
|
202 | - $query = str_replace(["\n\n", "\r"], ["\n", ''], $query); |
|
203 | - } |
|
204 | - |
|
205 | - $this->mockTask->setSrc(new File(PHING_TEST_BASE . '/etc/tasks/ext/pdo/delimiters-pgsql.sql')); |
|
206 | - $this->mockTask->setUrl('pgsql:host=localhost;dbname=phing'); |
|
207 | - $this->mockTask->setDelimiterType(PDOSQLExecTask::DELIM_NORMAL); |
|
208 | - $this->project->setProperty('bar.value', 'some value'); |
|
209 | - $this->project->executeTarget('test'); |
|
210 | - |
|
211 | - $this->assertEquals($expected, $this->queries); |
|
212 | - } |
|
213 | -} |
@@ -70,144 +70,3 @@ |
||
70 | 70 | // for some reason default splitter mangles spaces on subsequent lines |
71 | 71 | $expected = [ |
72 | 72 | <<<'SQL' |
73 | - insert into foo (bar, "strange;name""indeed") values ('bar''s value containing ;', 'a value for strange named column') |
|
74 | - SQL, |
|
75 | - <<<'SQL' |
|
76 | - delete |
|
77 | - from |
|
78 | - foo where bar = 'some value' |
|
79 | - SQL, |
|
80 | - <<<'SQL' |
|
81 | - update dump -- I should not be ignored |
|
82 | - set message = 'I am a string with \\ backslash \' escapes and semicolons;' |
|
83 | - SQL, |
|
84 | - <<<'SQL' |
|
85 | - create procedure setfoo(newfoo int) |
|
86 | - begin |
|
87 | - set @foo = newfoo; |
|
88 | - end |
|
89 | - SQL, |
|
90 | - <<<'SQL' |
|
91 | - insert into dump (message) values ('I am a statement not ending with a delimiter') |
|
92 | - SQL, |
|
93 | - ]; |
|
94 | - // and insists on "\n" linebreaks |
|
95 | - foreach ($expected as &$query) { |
|
96 | - $query = str_replace(["\n\n", "\r"], ["\n", ''], $query); |
|
97 | - } |
|
98 | - |
|
99 | - $this->mockTask->setSrc(new File(PHING_TEST_BASE . '/etc/tasks/ext/pdo/delimiters-normal.sql')); |
|
100 | - $this->mockTask->setDelimiterType(PDOSQLExecTask::DELIM_NORMAL); |
|
101 | - $this->project->setProperty('bar.value', 'some value'); |
|
102 | - $this->project->executeTarget('test'); |
|
103 | - |
|
104 | - $this->assertEquals($expected, $this->queries); |
|
105 | - } |
|
106 | - |
|
107 | - public function testDelimiterTypeRow() |
|
108 | - { |
|
109 | - // for some reason default splitter mangles spaces on subsequent lines |
|
110 | - $expected = [ |
|
111 | - <<<'SQL' |
|
112 | - insert into "duh" (foo) values ('duh') |
|
113 | - SQL, |
|
114 | - <<<'SQL' |
|
115 | - update "duh?" -- I should not be ignored |
|
116 | - set foo = 'some value' |
|
117 | - SQL, |
|
118 | - <<<'SQL' |
|
119 | - insert into dump (message) values ('I am a statement not ending with a delimiter') |
|
120 | - SQL, |
|
121 | - ]; |
|
122 | - // and insists on "\n" linebreaks |
|
123 | - foreach ($expected as &$query) { |
|
124 | - $query = str_replace(["\n\n", "\r"], ["\n", ''], $query); |
|
125 | - } |
|
126 | - |
|
127 | - $this->mockTask->setSrc(new File(PHING_TEST_BASE . '/etc/tasks/ext/pdo/delimiters-row.sql')); |
|
128 | - $this->mockTask->setDelimiterType(PDOSQLExecTask::DELIM_ROW); |
|
129 | - $this->mockTask->setDelimiter('duh'); |
|
130 | - $this->project->setProperty('foo.value', 'some value'); |
|
131 | - $this->project->executeTarget('test'); |
|
132 | - |
|
133 | - $this->assertEquals($expected, $this->queries); |
|
134 | - } |
|
135 | - |
|
136 | - /** |
|
137 | - * Checks that PDOSQLExecTask properly understands PostgreSQL dialect |
|
138 | - * (especially "dollar quoting") when working with 'pgsql:' URLs. |
|
139 | - * |
|
140 | - * @see http://www.phing.info/trac/ticket/499 |
|
141 | - * @see http://www.postgresql.org/docs/9.0/interactive/sql-syntax-lexical.html#SQL-SYNTAX-DOLLAR-QUOTING |
|
142 | - */ |
|
143 | - public function testRequest499() |
|
144 | - { |
|
145 | - $expected = [ |
|
146 | - <<<'SQL' |
|
147 | - select 1 |
|
148 | - # 2 |
|
149 | - SQL, |
|
150 | - <<<'SQL' |
|
151 | - select 'foo' |
|
152 | - // 'bar' |
|
153 | - SQL, |
|
154 | - <<<'SQL' |
|
155 | - insert into foo (bar, "strange;name""indeed") values ('bar''s value containing ;', 'a value for strange named column') |
|
156 | - SQL, |
|
157 | - <<<'SQL' |
|
158 | - create function foo(text) |
|
159 | - returns boolean as |
|
160 | - $function$ |
|
161 | - BEGIN |
|
162 | - RETURN ($1 ~ $q$[\t\r\n\v\\]$q$); |
|
163 | - END; |
|
164 | - $function$ |
|
165 | - language plpgsql |
|
166 | - SQL, |
|
167 | - <<<'SQL' |
|
168 | - CREATE FUNCTION phingPDOtest() RETURNS "trigger" |
|
169 | - AS $_X$ |
|
170 | - if (1) |
|
171 | - { |
|
172 | - # All is well - just continue |
|
173 | - |
|
174 | - return; |
|
175 | - } |
|
176 | - else |
|
177 | - { |
|
178 | - # Not good - this is probably a fatal error! |
|
179 | - elog(ERROR,"True is not true"); |
|
180 | - |
|
181 | - return "SKIP"; |
|
182 | - } |
|
183 | - $_X$ |
|
184 | - LANGUAGE plperl |
|
185 | - SQL, |
|
186 | - "insert into foo (bar) \nvalues ('some value')", |
|
187 | - <<<'SQL' |
|
188 | - insert into foo (bar) values ($$ a dollar-quoted string containing a few quotes ' ", a $placeholder$ and a semicolon;$$) |
|
189 | - SQL, |
|
190 | - <<<'SQL' |
|
191 | - create rule blah_insert |
|
192 | - as on insert to blah do instead ( |
|
193 | - insert into foo values (new.id, 'blah'); |
|
194 | - insert into bar values (new.id, 'blah-blah'); |
|
195 | - ) |
|
196 | - SQL, |
|
197 | - <<<'SQL' |
|
198 | - insert into dump (message) values ('I am a statement not ending with a delimiter') |
|
199 | - SQL, |
|
200 | - ]; |
|
201 | - foreach ($expected as &$query) { |
|
202 | - $query = str_replace(["\n\n", "\r"], ["\n", ''], $query); |
|
203 | - } |
|
204 | - |
|
205 | - $this->mockTask->setSrc(new File(PHING_TEST_BASE . '/etc/tasks/ext/pdo/delimiters-pgsql.sql')); |
|
206 | - $this->mockTask->setUrl('pgsql:host=localhost;dbname=phing'); |
|
207 | - $this->mockTask->setDelimiterType(PDOSQLExecTask::DELIM_NORMAL); |
|
208 | - $this->project->setProperty('bar.value', 'some value'); |
|
209 | - $this->project->executeTarget('test'); |
|
210 | - |
|
211 | - $this->assertEquals($expected, $this->queries); |
|
212 | - } |
|
213 | -} |
@@ -70,144 +70,3 @@ |
||
70 | 70 | // for some reason default splitter mangles spaces on subsequent lines |
71 | 71 | $expected = [ |
72 | 72 | <<<'SQL' |
73 | - insert into foo (bar, "strange;name""indeed") values ('bar''s value containing ;', 'a value for strange named column') |
|
74 | - SQL, |
|
75 | - <<<'SQL' |
|
76 | - delete |
|
77 | - from |
|
78 | - foo where bar = 'some value' |
|
79 | - SQL, |
|
80 | - <<<'SQL' |
|
81 | - update dump -- I should not be ignored |
|
82 | - set message = 'I am a string with \\ backslash \' escapes and semicolons;' |
|
83 | - SQL, |
|
84 | - <<<'SQL' |
|
85 | - create procedure setfoo(newfoo int) |
|
86 | - begin |
|
87 | - set @foo = newfoo; |
|
88 | - end |
|
89 | - SQL, |
|
90 | - <<<'SQL' |
|
91 | - insert into dump (message) values ('I am a statement not ending with a delimiter') |
|
92 | - SQL, |
|
93 | - ]; |
|
94 | - // and insists on "\n" linebreaks |
|
95 | - foreach ($expected as &$query) { |
|
96 | - $query = str_replace(["\n\n", "\r"], ["\n", ''], $query); |
|
97 | - } |
|
98 | - |
|
99 | - $this->mockTask->setSrc(new File(PHING_TEST_BASE . '/etc/tasks/ext/pdo/delimiters-normal.sql')); |
|
100 | - $this->mockTask->setDelimiterType(PDOSQLExecTask::DELIM_NORMAL); |
|
101 | - $this->project->setProperty('bar.value', 'some value'); |
|
102 | - $this->project->executeTarget('test'); |
|
103 | - |
|
104 | - $this->assertEquals($expected, $this->queries); |
|
105 | - } |
|
106 | - |
|
107 | - public function testDelimiterTypeRow() |
|
108 | - { |
|
109 | - // for some reason default splitter mangles spaces on subsequent lines |
|
110 | - $expected = [ |
|
111 | - <<<'SQL' |
|
112 | - insert into "duh" (foo) values ('duh') |
|
113 | - SQL, |
|
114 | - <<<'SQL' |
|
115 | - update "duh?" -- I should not be ignored |
|
116 | - set foo = 'some value' |
|
117 | - SQL, |
|
118 | - <<<'SQL' |
|
119 | - insert into dump (message) values ('I am a statement not ending with a delimiter') |
|
120 | - SQL, |
|
121 | - ]; |
|
122 | - // and insists on "\n" linebreaks |
|
123 | - foreach ($expected as &$query) { |
|
124 | - $query = str_replace(["\n\n", "\r"], ["\n", ''], $query); |
|
125 | - } |
|
126 | - |
|
127 | - $this->mockTask->setSrc(new File(PHING_TEST_BASE . '/etc/tasks/ext/pdo/delimiters-row.sql')); |
|
128 | - $this->mockTask->setDelimiterType(PDOSQLExecTask::DELIM_ROW); |
|
129 | - $this->mockTask->setDelimiter('duh'); |
|
130 | - $this->project->setProperty('foo.value', 'some value'); |
|
131 | - $this->project->executeTarget('test'); |
|
132 | - |
|
133 | - $this->assertEquals($expected, $this->queries); |
|
134 | - } |
|
135 | - |
|
136 | - /** |
|
137 | - * Checks that PDOSQLExecTask properly understands PostgreSQL dialect |
|
138 | - * (especially "dollar quoting") when working with 'pgsql:' URLs. |
|
139 | - * |
|
140 | - * @see http://www.phing.info/trac/ticket/499 |
|
141 | - * @see http://www.postgresql.org/docs/9.0/interactive/sql-syntax-lexical.html#SQL-SYNTAX-DOLLAR-QUOTING |
|
142 | - */ |
|
143 | - public function testRequest499() |
|
144 | - { |
|
145 | - $expected = [ |
|
146 | - <<<'SQL' |
|
147 | - select 1 |
|
148 | - # 2 |
|
149 | - SQL, |
|
150 | - <<<'SQL' |
|
151 | - select 'foo' |
|
152 | - // 'bar' |
|
153 | - SQL, |
|
154 | - <<<'SQL' |
|
155 | - insert into foo (bar, "strange;name""indeed") values ('bar''s value containing ;', 'a value for strange named column') |
|
156 | - SQL, |
|
157 | - <<<'SQL' |
|
158 | - create function foo(text) |
|
159 | - returns boolean as |
|
160 | - $function$ |
|
161 | - BEGIN |
|
162 | - RETURN ($1 ~ $q$[\t\r\n\v\\]$q$); |
|
163 | - END; |
|
164 | - $function$ |
|
165 | - language plpgsql |
|
166 | - SQL, |
|
167 | - <<<'SQL' |
|
168 | - CREATE FUNCTION phingPDOtest() RETURNS "trigger" |
|
169 | - AS $_X$ |
|
170 | - if (1) |
|
171 | - { |
|
172 | - # All is well - just continue |
|
173 | - |
|
174 | - return; |
|
175 | - } |
|
176 | - else |
|
177 | - { |
|
178 | - # Not good - this is probably a fatal error! |
|
179 | - elog(ERROR,"True is not true"); |
|
180 | - |
|
181 | - return "SKIP"; |
|
182 | - } |
|
183 | - $_X$ |
|
184 | - LANGUAGE plperl |
|
185 | - SQL, |
|
186 | - "insert into foo (bar) \nvalues ('some value')", |
|
187 | - <<<'SQL' |
|
188 | - insert into foo (bar) values ($$ a dollar-quoted string containing a few quotes ' ", a $placeholder$ and a semicolon;$$) |
|
189 | - SQL, |
|
190 | - <<<'SQL' |
|
191 | - create rule blah_insert |
|
192 | - as on insert to blah do instead ( |
|
193 | - insert into foo values (new.id, 'blah'); |
|
194 | - insert into bar values (new.id, 'blah-blah'); |
|
195 | - ) |
|
196 | - SQL, |
|
197 | - <<<'SQL' |
|
198 | - insert into dump (message) values ('I am a statement not ending with a delimiter') |
|
199 | - SQL, |
|
200 | - ]; |
|
201 | - foreach ($expected as &$query) { |
|
202 | - $query = str_replace(["\n\n", "\r"], ["\n", ''], $query); |
|
203 | - } |
|
204 | - |
|
205 | - $this->mockTask->setSrc(new File(PHING_TEST_BASE . '/etc/tasks/ext/pdo/delimiters-pgsql.sql')); |
|
206 | - $this->mockTask->setUrl('pgsql:host=localhost;dbname=phing'); |
|
207 | - $this->mockTask->setDelimiterType(PDOSQLExecTask::DELIM_NORMAL); |
|
208 | - $this->project->setProperty('bar.value', 'some value'); |
|
209 | - $this->project->executeTarget('test'); |
|
210 | - |
|
211 | - $this->assertEquals($expected, $this->queries); |
|
212 | - } |
|
213 | -} |
@@ -70,144 +70,3 @@ |
||
70 | 70 | // for some reason default splitter mangles spaces on subsequent lines |
71 | 71 | $expected = [ |
72 | 72 | <<<'SQL' |
73 | - insert into foo (bar, "strange;name""indeed") values ('bar''s value containing ;', 'a value for strange named column') |
|
74 | - SQL, |
|
75 | - <<<'SQL' |
|
76 | - delete |
|
77 | - from |
|
78 | - foo where bar = 'some value' |
|
79 | - SQL, |
|
80 | - <<<'SQL' |
|
81 | - update dump -- I should not be ignored |
|
82 | - set message = 'I am a string with \\ backslash \' escapes and semicolons;' |
|
83 | - SQL, |
|
84 | - <<<'SQL' |
|
85 | - create procedure setfoo(newfoo int) |
|
86 | - begin |
|
87 | - set @foo = newfoo; |
|
88 | - end |
|
89 | - SQL, |
|
90 | - <<<'SQL' |
|
91 | - insert into dump (message) values ('I am a statement not ending with a delimiter') |
|
92 | - SQL, |
|
93 | - ]; |
|
94 | - // and insists on "\n" linebreaks |
|
95 | - foreach ($expected as &$query) { |
|
96 | - $query = str_replace(["\n\n", "\r"], ["\n", ''], $query); |
|
97 | - } |
|
98 | - |
|
99 | - $this->mockTask->setSrc(new File(PHING_TEST_BASE . '/etc/tasks/ext/pdo/delimiters-normal.sql')); |
|
100 | - $this->mockTask->setDelimiterType(PDOSQLExecTask::DELIM_NORMAL); |
|
101 | - $this->project->setProperty('bar.value', 'some value'); |
|
102 | - $this->project->executeTarget('test'); |
|
103 | - |
|
104 | - $this->assertEquals($expected, $this->queries); |
|
105 | - } |
|
106 | - |
|
107 | - public function testDelimiterTypeRow() |
|
108 | - { |
|
109 | - // for some reason default splitter mangles spaces on subsequent lines |
|
110 | - $expected = [ |
|
111 | - <<<'SQL' |
|
112 | - insert into "duh" (foo) values ('duh') |
|
113 | - SQL, |
|
114 | - <<<'SQL' |
|
115 | - update "duh?" -- I should not be ignored |
|
116 | - set foo = 'some value' |
|
117 | - SQL, |
|
118 | - <<<'SQL' |
|
119 | - insert into dump (message) values ('I am a statement not ending with a delimiter') |
|
120 | - SQL, |
|
121 | - ]; |
|
122 | - // and insists on "\n" linebreaks |
|
123 | - foreach ($expected as &$query) { |
|
124 | - $query = str_replace(["\n\n", "\r"], ["\n", ''], $query); |
|
125 | - } |
|
126 | - |
|
127 | - $this->mockTask->setSrc(new File(PHING_TEST_BASE . '/etc/tasks/ext/pdo/delimiters-row.sql')); |
|
128 | - $this->mockTask->setDelimiterType(PDOSQLExecTask::DELIM_ROW); |
|
129 | - $this->mockTask->setDelimiter('duh'); |
|
130 | - $this->project->setProperty('foo.value', 'some value'); |
|
131 | - $this->project->executeTarget('test'); |
|
132 | - |
|
133 | - $this->assertEquals($expected, $this->queries); |
|
134 | - } |
|
135 | - |
|
136 | - /** |
|
137 | - * Checks that PDOSQLExecTask properly understands PostgreSQL dialect |
|
138 | - * (especially "dollar quoting") when working with 'pgsql:' URLs. |
|
139 | - * |
|
140 | - * @see http://www.phing.info/trac/ticket/499 |
|
141 | - * @see http://www.postgresql.org/docs/9.0/interactive/sql-syntax-lexical.html#SQL-SYNTAX-DOLLAR-QUOTING |
|
142 | - */ |
|
143 | - public function testRequest499() |
|
144 | - { |
|
145 | - $expected = [ |
|
146 | - <<<'SQL' |
|
147 | - select 1 |
|
148 | - # 2 |
|
149 | - SQL, |
|
150 | - <<<'SQL' |
|
151 | - select 'foo' |
|
152 | - // 'bar' |
|
153 | - SQL, |
|
154 | - <<<'SQL' |
|
155 | - insert into foo (bar, "strange;name""indeed") values ('bar''s value containing ;', 'a value for strange named column') |
|
156 | - SQL, |
|
157 | - <<<'SQL' |
|
158 | - create function foo(text) |
|
159 | - returns boolean as |
|
160 | - $function$ |
|
161 | - BEGIN |
|
162 | - RETURN ($1 ~ $q$[\t\r\n\v\\]$q$); |
|
163 | - END; |
|
164 | - $function$ |
|
165 | - language plpgsql |
|
166 | - SQL, |
|
167 | - <<<'SQL' |
|
168 | - CREATE FUNCTION phingPDOtest() RETURNS "trigger" |
|
169 | - AS $_X$ |
|
170 | - if (1) |
|
171 | - { |
|
172 | - # All is well - just continue |
|
173 | - |
|
174 | - return; |
|
175 | - } |
|
176 | - else |
|
177 | - { |
|
178 | - # Not good - this is probably a fatal error! |
|
179 | - elog(ERROR,"True is not true"); |
|
180 | - |
|
181 | - return "SKIP"; |
|
182 | - } |
|
183 | - $_X$ |
|
184 | - LANGUAGE plperl |
|
185 | - SQL, |
|
186 | - "insert into foo (bar) \nvalues ('some value')", |
|
187 | - <<<'SQL' |
|
188 | - insert into foo (bar) values ($$ a dollar-quoted string containing a few quotes ' ", a $placeholder$ and a semicolon;$$) |
|
189 | - SQL, |
|
190 | - <<<'SQL' |
|
191 | - create rule blah_insert |
|
192 | - as on insert to blah do instead ( |
|
193 | - insert into foo values (new.id, 'blah'); |
|
194 | - insert into bar values (new.id, 'blah-blah'); |
|
195 | - ) |
|
196 | - SQL, |
|
197 | - <<<'SQL' |
|
198 | - insert into dump (message) values ('I am a statement not ending with a delimiter') |
|
199 | - SQL, |
|
200 | - ]; |
|
201 | - foreach ($expected as &$query) { |
|
202 | - $query = str_replace(["\n\n", "\r"], ["\n", ''], $query); |
|
203 | - } |
|
204 | - |
|
205 | - $this->mockTask->setSrc(new File(PHING_TEST_BASE . '/etc/tasks/ext/pdo/delimiters-pgsql.sql')); |
|
206 | - $this->mockTask->setUrl('pgsql:host=localhost;dbname=phing'); |
|
207 | - $this->mockTask->setDelimiterType(PDOSQLExecTask::DELIM_NORMAL); |
|
208 | - $this->project->setProperty('bar.value', 'some value'); |
|
209 | - $this->project->executeTarget('test'); |
|
210 | - |
|
211 | - $this->assertEquals($expected, $this->queries); |
|
212 | - } |
|
213 | -} |
@@ -70,144 +70,3 @@ |
||
70 | 70 | // for some reason default splitter mangles spaces on subsequent lines |
71 | 71 | $expected = [ |
72 | 72 | <<<'SQL' |
73 | - insert into foo (bar, "strange;name""indeed") values ('bar''s value containing ;', 'a value for strange named column') |
|
74 | - SQL, |
|
75 | - <<<'SQL' |
|
76 | - delete |
|
77 | - from |
|
78 | - foo where bar = 'some value' |
|
79 | - SQL, |
|
80 | - <<<'SQL' |
|
81 | - update dump -- I should not be ignored |
|
82 | - set message = 'I am a string with \\ backslash \' escapes and semicolons;' |
|
83 | - SQL, |
|
84 | - <<<'SQL' |
|
85 | - create procedure setfoo(newfoo int) |
|
86 | - begin |
|
87 | - set @foo = newfoo; |
|
88 | - end |
|
89 | - SQL, |
|
90 | - <<<'SQL' |
|
91 | - insert into dump (message) values ('I am a statement not ending with a delimiter') |
|
92 | - SQL, |
|
93 | - ]; |
|
94 | - // and insists on "\n" linebreaks |
|
95 | - foreach ($expected as &$query) { |
|
96 | - $query = str_replace(["\n\n", "\r"], ["\n", ''], $query); |
|
97 | - } |
|
98 | - |
|
99 | - $this->mockTask->setSrc(new File(PHING_TEST_BASE . '/etc/tasks/ext/pdo/delimiters-normal.sql')); |
|
100 | - $this->mockTask->setDelimiterType(PDOSQLExecTask::DELIM_NORMAL); |
|
101 | - $this->project->setProperty('bar.value', 'some value'); |
|
102 | - $this->project->executeTarget('test'); |
|
103 | - |
|
104 | - $this->assertEquals($expected, $this->queries); |
|
105 | - } |
|
106 | - |
|
107 | - public function testDelimiterTypeRow() |
|
108 | - { |
|
109 | - // for some reason default splitter mangles spaces on subsequent lines |
|
110 | - $expected = [ |
|
111 | - <<<'SQL' |
|
112 | - insert into "duh" (foo) values ('duh') |
|
113 | - SQL, |
|
114 | - <<<'SQL' |
|
115 | - update "duh?" -- I should not be ignored |
|
116 | - set foo = 'some value' |
|
117 | - SQL, |
|
118 | - <<<'SQL' |
|
119 | - insert into dump (message) values ('I am a statement not ending with a delimiter') |
|
120 | - SQL, |
|
121 | - ]; |
|
122 | - // and insists on "\n" linebreaks |
|
123 | - foreach ($expected as &$query) { |
|
124 | - $query = str_replace(["\n\n", "\r"], ["\n", ''], $query); |
|
125 | - } |
|
126 | - |
|
127 | - $this->mockTask->setSrc(new File(PHING_TEST_BASE . '/etc/tasks/ext/pdo/delimiters-row.sql')); |
|
128 | - $this->mockTask->setDelimiterType(PDOSQLExecTask::DELIM_ROW); |
|
129 | - $this->mockTask->setDelimiter('duh'); |
|
130 | - $this->project->setProperty('foo.value', 'some value'); |
|
131 | - $this->project->executeTarget('test'); |
|
132 | - |
|
133 | - $this->assertEquals($expected, $this->queries); |
|
134 | - } |
|
135 | - |
|
136 | - /** |
|
137 | - * Checks that PDOSQLExecTask properly understands PostgreSQL dialect |
|
138 | - * (especially "dollar quoting") when working with 'pgsql:' URLs. |
|
139 | - * |
|
140 | - * @see http://www.phing.info/trac/ticket/499 |
|
141 | - * @see http://www.postgresql.org/docs/9.0/interactive/sql-syntax-lexical.html#SQL-SYNTAX-DOLLAR-QUOTING |
|
142 | - */ |
|
143 | - public function testRequest499() |
|
144 | - { |
|
145 | - $expected = [ |
|
146 | - <<<'SQL' |
|
147 | - select 1 |
|
148 | - # 2 |
|
149 | - SQL, |
|
150 | - <<<'SQL' |
|
151 | - select 'foo' |
|
152 | - // 'bar' |
|
153 | - SQL, |
|
154 | - <<<'SQL' |
|
155 | - insert into foo (bar, "strange;name""indeed") values ('bar''s value containing ;', 'a value for strange named column') |
|
156 | - SQL, |
|
157 | - <<<'SQL' |
|
158 | - create function foo(text) |
|
159 | - returns boolean as |
|
160 | - $function$ |
|
161 | - BEGIN |
|
162 | - RETURN ($1 ~ $q$[\t\r\n\v\\]$q$); |
|
163 | - END; |
|
164 | - $function$ |
|
165 | - language plpgsql |
|
166 | - SQL, |
|
167 | - <<<'SQL' |
|
168 | - CREATE FUNCTION phingPDOtest() RETURNS "trigger" |
|
169 | - AS $_X$ |
|
170 | - if (1) |
|
171 | - { |
|
172 | - # All is well - just continue |
|
173 | - |
|
174 | - return; |
|
175 | - } |
|
176 | - else |
|
177 | - { |
|
178 | - # Not good - this is probably a fatal error! |
|
179 | - elog(ERROR,"True is not true"); |
|
180 | - |
|
181 | - return "SKIP"; |
|
182 | - } |
|
183 | - $_X$ |
|
184 | - LANGUAGE plperl |
|
185 | - SQL, |
|
186 | - "insert into foo (bar) \nvalues ('some value')", |
|
187 | - <<<'SQL' |
|
188 | - insert into foo (bar) values ($$ a dollar-quoted string containing a few quotes ' ", a $placeholder$ and a semicolon;$$) |
|
189 | - SQL, |
|
190 | - <<<'SQL' |
|
191 | - create rule blah_insert |
|
192 | - as on insert to blah do instead ( |
|
193 | - insert into foo values (new.id, 'blah'); |
|
194 | - insert into bar values (new.id, 'blah-blah'); |
|
195 | - ) |
|
196 | - SQL, |
|
197 | - <<<'SQL' |
|
198 | - insert into dump (message) values ('I am a statement not ending with a delimiter') |
|
199 | - SQL, |
|
200 | - ]; |
|
201 | - foreach ($expected as &$query) { |
|
202 | - $query = str_replace(["\n\n", "\r"], ["\n", ''], $query); |
|
203 | - } |
|
204 | - |
|
205 | - $this->mockTask->setSrc(new File(PHING_TEST_BASE . '/etc/tasks/ext/pdo/delimiters-pgsql.sql')); |
|
206 | - $this->mockTask->setUrl('pgsql:host=localhost;dbname=phing'); |
|
207 | - $this->mockTask->setDelimiterType(PDOSQLExecTask::DELIM_NORMAL); |
|
208 | - $this->project->setProperty('bar.value', 'some value'); |
|
209 | - $this->project->executeTarget('test'); |
|
210 | - |
|
211 | - $this->assertEquals($expected, $this->queries); |
|
212 | - } |
|
213 | -} |
@@ -50,15 +50,3 @@ |
||
50 | 50 | $this->assertStringEqualsFile( |
51 | 51 | $this->getProject()->getProperty('file'), |
52 | 52 | <<< 'XML' |
53 | - <project name="failure" default="" basedir="."> |
|
54 | - <fail message="foo=bar"/> |
|
55 | - </project> |
|
56 | - XML |
|
57 | - ); |
|
58 | - } |
|
59 | - |
|
60 | - public function testEmpty(): void |
|
61 | - { |
|
62 | - $this->expectBuildException('testEmpty', 'No nested XML specified'); |
|
63 | - } |
|
64 | -} |
@@ -50,15 +50,3 @@ |
||
50 | 50 | $this->assertStringEqualsFile( |
51 | 51 | $this->getProject()->getProperty('file'), |
52 | 52 | <<< 'XML' |
53 | - <project name="failure" default="" basedir="."> |
|
54 | - <fail message="foo=bar"/> |
|
55 | - </project> |
|
56 | - XML |
|
57 | - ); |
|
58 | - } |
|
59 | - |
|
60 | - public function testEmpty(): void |
|
61 | - { |
|
62 | - $this->expectBuildException('testEmpty', 'No nested XML specified'); |
|
63 | - } |
|
64 | -} |
@@ -50,15 +50,3 @@ |
||
50 | 50 | $this->assertStringEqualsFile( |
51 | 51 | $this->getProject()->getProperty('file'), |
52 | 52 | <<< 'XML' |
53 | - <project name="failure" default="" basedir="."> |
|
54 | - <fail message="foo=bar"/> |
|
55 | - </project> |
|
56 | - XML |
|
57 | - ); |
|
58 | - } |
|
59 | - |
|
60 | - public function testEmpty(): void |
|
61 | - { |
|
62 | - $this->expectBuildException('testEmpty', 'No nested XML specified'); |
|
63 | - } |
|
64 | -} |
@@ -50,15 +50,3 @@ |
||
50 | 50 | $this->assertStringEqualsFile( |
51 | 51 | $this->getProject()->getProperty('file'), |
52 | 52 | <<< 'XML' |
53 | - <project name="failure" default="" basedir="."> |
|
54 | - <fail message="foo=bar"/> |
|
55 | - </project> |
|
56 | - XML |
|
57 | - ); |
|
58 | - } |
|
59 | - |
|
60 | - public function testEmpty(): void |
|
61 | - { |
|
62 | - $this->expectBuildException('testEmpty', 'No nested XML specified'); |
|
63 | - } |
|
64 | -} |
@@ -50,15 +50,3 @@ |
||
50 | 50 | $this->assertStringEqualsFile( |
51 | 51 | $this->getProject()->getProperty('file'), |
52 | 52 | <<< 'XML' |
53 | - <project name="failure" default="" basedir="."> |
|
54 | - <fail message="foo=bar"/> |
|
55 | - </project> |
|
56 | - XML |
|
57 | - ); |
|
58 | - } |
|
59 | - |
|
60 | - public function testEmpty(): void |
|
61 | - { |
|
62 | - $this->expectBuildException('testEmpty', 'No nested XML specified'); |
|
63 | - } |
|
64 | -} |
@@ -47,12 +47,3 @@ |
||
47 | 47 | $resultFile = $this->getProject()->resolveFile('result/stripwhitespace.test'); |
48 | 48 | |
49 | 49 | $expected = <<<'EXPECTED' |
50 | - <?php |
|
51 | - class { public function __construct() { return ''; } } |
|
52 | - EXPECTED; |
|
53 | - |
|
54 | - $result = file_get_contents($resultFile->getAbsolutePath()); |
|
55 | - |
|
56 | - $this->assertEquals($expected, $result, "Files don't match!"); |
|
57 | - } |
|
58 | -} |
@@ -47,12 +47,3 @@ |
||
47 | 47 | $resultFile = $this->getProject()->resolveFile('result/stripwhitespace.test'); |
48 | 48 | |
49 | 49 | $expected = <<<'EXPECTED' |
50 | - <?php |
|
51 | - class { public function __construct() { return ''; } } |
|
52 | - EXPECTED; |
|
53 | - |
|
54 | - $result = file_get_contents($resultFile->getAbsolutePath()); |
|
55 | - |
|
56 | - $this->assertEquals($expected, $result, "Files don't match!"); |
|
57 | - } |
|
58 | -} |
@@ -47,12 +47,3 @@ |
||
47 | 47 | $resultFile = $this->getProject()->resolveFile('result/stripwhitespace.test'); |
48 | 48 | |
49 | 49 | $expected = <<<'EXPECTED' |
50 | - <?php |
|
51 | - class { public function __construct() { return ''; } } |
|
52 | - EXPECTED; |
|
53 | - |
|
54 | - $result = file_get_contents($resultFile->getAbsolutePath()); |
|
55 | - |
|
56 | - $this->assertEquals($expected, $result, "Files don't match!"); |
|
57 | - } |
|
58 | -} |
@@ -47,12 +47,3 @@ |
||
47 | 47 | $resultFile = $this->getProject()->resolveFile('result/stripwhitespace.test'); |
48 | 48 | |
49 | 49 | $expected = <<<'EXPECTED' |
50 | - <?php |
|
51 | - class { public function __construct() { return ''; } } |
|
52 | - EXPECTED; |
|
53 | - |
|
54 | - $result = file_get_contents($resultFile->getAbsolutePath()); |
|
55 | - |
|
56 | - $this->assertEquals($expected, $result, "Files don't match!"); |
|
57 | - } |
|
58 | -} |
@@ -47,12 +47,3 @@ |
||
47 | 47 | $resultFile = $this->getProject()->resolveFile('result/stripwhitespace.test'); |
48 | 48 | |
49 | 49 | $expected = <<<'EXPECTED' |
50 | - <?php |
|
51 | - class { public function __construct() { return ''; } } |
|
52 | - EXPECTED; |
|
53 | - |
|
54 | - $result = file_get_contents($resultFile->getAbsolutePath()); |
|
55 | - |
|
56 | - $this->assertEquals($expected, $result, "Files don't match!"); |
|
57 | - } |
|
58 | -} |