Skip to content

Commit 0ea30f5

Browse files
author
Eric James Michael Ritz
committed
GitHub-Issue: 115 (Unit Test)
We expect this test to fail because of a current limitation in the test suite. In order to test for indentation we use ‘magic comments’ and describe the correct, expected offset for indentation that we want to see when running the tests. The test for issue 115 has this: // ###php-mode-test### ((indent c-lineup-cascaded-calls)) The test suite code will fail on this magic comment because it tries to treat `c-lineup-cascaded-calls' like a variable that we can compare to the indentation. The problem is that `c-lineup-cascaded-calls' is a function, and we need to apply it to the correct ‘language element’ in order to get an indentation we can compare against. Until the test suite supports this behavior we will expect the test for issue 115 to always fail.
1 parent 6db85bd commit 0ea30f5

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

php-mode-test.el

+5
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,8 @@ an error."
209209
(ert-deftest php-mode-test-issue-99 ()
210210
"Proper indentation for 'foreach' statements without braces."
211211
(with-php-mode-test ("issue-99.php" :indent t :magic t)))
212+
213+
(ert-deftest php-mode-test-issue-115 ()
214+
"Proper alignment for chained method calls inside arrays."
215+
:expected-result :failed
216+
(with-php-mode-test ("issue-115.php" :indent t :magic t)))

tests/issue-115.php

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
/**
4+
* Github Issue: https://github.com/ejmr/php-mode/issues/115
5+
*
6+
* This tests for aligning method calls within arrays, similar to what
7+
* we do in the test for issue 19. The method calls below should all
8+
* align vertically along the '->' characters.
9+
*
10+
*/
11+
12+
$x = ["x" => $this->foo()
13+
->bar() // ###php-mode-test### ((indent c-lineup-cascaded-calls))
14+
->baz()]; // ###php-mode-test### ((indent c-lineup-cascaded-calls))
15+
16+
$y = array("y" => $this->foo()
17+
->bar() // ###php-mode-test### ((indent c-lineup-cascaded-calls))
18+
->baz()); // ###php-mode-test### ((indent c-lineup-cascaded-calls))

0 commit comments

Comments
 (0)