@@ -80,6 +80,7 @@ the coding style to one of the following:
80
80
2. `drupal'
81
81
3. `wordpress'
82
82
4. `symfony2'
83
+ 5. `psr2'
83
84
84
85
Using any other symbol for STYLE results in undefined behavior.
85
86
The test will use the PHP style by default.
@@ -97,6 +98,7 @@ run with specific customizations set."
97
98
(drupal '(php-enable-drupal-coding-style))
98
99
(wordpress '(php-enable-wordpress-coding-style))
99
100
(symfony2 '(php-enable-symfony2-coding-style))
101
+ (psr2 '(php-enable-psr2-coding-style))
100
102
(t '(php-enable-default-coding-style)))
101
103
102
104
,(unless custom '(custom-set-variables '(php-lineup-cascaded-calls nil )))
@@ -440,16 +442,16 @@ style from Drupal."
440
442
(ert-deftest php-mode-test-language-constructs()
441
443
" Test highlighting of language constructs and reserved keywords"
442
444
(with-php-mode-test (" language-constructs.php" )
443
- (while (search-forward " ClassName" nil t )
444
- (backward-char )
445
- (should (eq 'font-lock-type-face
446
- (get-text-property (point ) 'face )))))
445
+ (while (search-forward " ClassName" nil t )
446
+ (backward-char )
447
+ (should (eq 'font-lock-type-face
448
+ (get-text-property (point ) 'face )))))
447
449
(with-php-mode-test (" language-constructs.php" )
448
- (search-forward " Start:" )
449
- (while (not (= (line-number-at-pos ) (count-lines (point-min ) (point-max ))))
450
- (forward-line 1 )
451
- (should (eq 'font-lock-keyword-face
452
- (get-text-property (point ) 'face ))))))
450
+ (search-forward " Start:" )
451
+ (while (not (= (line-number-at-pos ) (count-lines (point-min ) (point-max ))))
452
+ (forward-line 1 )
453
+ (should (eq 'font-lock-keyword-face
454
+ (get-text-property (point ) 'face ))))))
453
455
454
456
(ert-deftest php-mode-test-issue-178 ()
455
457
" Highligth as keyword and following symbol"
@@ -474,21 +476,19 @@ style from Drupal."
474
476
" Indentation of switch case body preceeded by multiple case statements"
475
477
(with-php-mode-test (" issue-186.php" :indent t :magic t )))
476
478
477
-
478
479
(ert-deftest php-mode-test-issue-197 ()
479
480
" Test highlighting of member and function names (should not have type face)"
480
481
(with-php-mode-test (" issue-197.php" )
481
- (while
482
- (search-forward " $test->" nil t )
483
- (should-not (eq 'font-lock-type-face
484
- (get-text-property (point ) 'face ))))))
482
+ (while (search-forward " $test->" nil t )
483
+ (should-not (eq 'font-lock-type-face
484
+ (get-text-property (point ) 'face ))))))
485
485
486
486
(ert-deftest php-mode-test-issue-200 ()
487
487
" Test highlighting and elimination of extraneous whitespace in PSR-2 mode"
488
488
(with-php-mode-test (" issue-200.php" )
489
- (php-mode-custom-coding-style-set 'php-mode-coding-style 'psr2 )
490
- (should show-trailing-whitespace)
491
- (should (and (listp before-save-hook) (member 'delete-trailing-whitespace before-save-hook)))))
489
+ (php-mode-custom-coding-style-set 'php-mode-coding-style 'psr2 )
490
+ (should show-trailing-whitespace)
491
+ (should (and (listp before-save-hook) (member 'delete-trailing-whitespace before-save-hook)))))
492
492
493
493
(ert-deftest php-mode-test-issue-201 ()
494
494
" Test highlighting of special variables"
@@ -529,11 +529,26 @@ style from Drupal."
529
529
(ert-deftest php-mode-test-issue-184()
530
530
" Test indent-line for statements and heredoc end at beginning of lines"
531
531
(with-php-mode-test (" issue-184.php" )
532
- (search-forward " html;" )
533
- (php-cautious-indent-line)
534
- (should (eq (current-indentation ) 0 ))
535
- (search-forward " return;" )
536
- (php-cautious-indent-line)
537
- (should (eq (current-indentation ) c-basic-offset))))
532
+ (search-forward " html;" )
533
+ (php-cautious-indent-line)
534
+ (should (= (current-indentation ) 0 ))
535
+ (search-forward " return;" )
536
+ (php-cautious-indent-line)
537
+ (should (= (current-indentation ) c-basic-offset))))
538
+
539
+ (ert-deftest php-mode-test-switch-statements()
540
+ " Test indentation inside switch statements"
541
+ (with-php-mode-test (" switch-statements.php" :indent t :style pear)
542
+ (search-forward " case true:" )
543
+ (should (eq (current-indentation ) 0 ))
544
+ (search-forward " break" )
545
+ (should (eq (current-indentation ) c-basic-offset)))
546
+ (with-php-mode-test (" switch-statements.php" :indent t :style psr2)
547
+ (search-forward " case true:" )
548
+ (should (eq (current-indentation ) c-basic-offset))
549
+ (search-forward " break" )
550
+ (should (eq (current-indentation ) (* 2 c-basic-offset)))
551
+ (search-forward " return" )
552
+ (should (eq (current-indentation ) (* 2 c-basic-offset)))))
538
553
539
554
; ;; php-mode-test.el ends here
0 commit comments