;;; phps-mode-test-integration.el --- Tests for integration -*- lexical-binding: t -*-
;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
;; This file is not part of GNU Emacs.
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 2, or (at
;; your option) any later version.
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see .
;;; Commentary:
;; Run from terminal make test-integration
;;; Code:
(require 'ert)
(require 'phps-mode)
(require 'phps-mode-test)
(eval-when-compile
(require 'phps-mode-macros))
(defun phps-mode-test-integration--incremental-vs-initial-buffers ()
"Test for object-oriented PHP file."
(phps-mode-test--incremental-vs-intial-buffer
"")))
(phps-mode-test--incremental-vs-intial-buffer
""
"Integration-test 3 for function-oriented PHP"
;; Make changes
(goto-char 1)
(insert "foo = 'Foo';\n $this->bar = array('Bar1', 'Bar2', 'Bar3');\n }\n}\n\n$foo = new foo();\n$name = 'MyName';\n\necho <<foo.\nNow, I am printing some {$foo->bar[1]}.\nThis should print a capital 'A': \x41\nEOT;\n?>\n"
"Integration-test 12 complex HEREDOC adding new line with variable in it"
(goto-char 63)
(insert "inserting $variable "))
(phps-mode-test--incremental-vs-intial-buffer
"foo = 'Foo';\n $this->bar = array('Bar1', 'Bar2', 'Bar3');\n }\n}\n\n$foo = new foo();\n$name = 'MyName';\n\necho <<foo.\nNow, I am printing some {$foo->bar[1]}.\nThis should print a capital 'A': \x41\nEOT;\n?>\n"
"Integration-test 13 complex HEREDOC with removed heredoc delimiter"
(goto-char 85)
(kill-line))
(phps-mode-test--incremental-vs-intial-buffer
"foo = 'Foo';\n $this->bar = array('Bar1', 'Bar2', 'Bar3');\n }\n}\n\n$foo = new foo();\n$name = 'MyName';\n\necho <<foo.\nNow, I am printing some {$foo->bar[1]}.\nThis should print a capital 'A': \x41\nEOT;\n?>\n"
"Integration-test 14 complex HEREDOC with removed heredoc delimiter semicolon"
;; (message "\nTokens: %s" phps-mode-lex-analyzer--tokens)
;; (message "States: %s\n" phps-mode-lex-analyzer--states)
(goto-char 88)
(delete-char 1))
(phps-mode-test--incremental-vs-intial-buffer
"")))
(phps-mode-test--incremental-vs-intial-buffer
""))
(goto-char 117)
(execute-kbd-macro (kbd "")))
)
(defun phps-mode-test-integration ()
"Run test for integration."
;; (setq debug-on-error t)
(phps-mode-test-integration--incremental-vs-initial-buffers)
)
(phps-mode-test-integration)
(provide 'phps-mode-test-integration)
;;; phps-mode-test-integration.el ends here