git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Javier Spagnoletti via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Javier Spagnoletti <phansys@gmail.com>,
	Javier Spagnoletti <phansys@gmail.com>
Subject: [PATCH] userdiff: php: Improved tests catching "abstract" and "final" functions
Date: Sat, 14 Nov 2020 21:18:07 +0000	[thread overview]
Message-ID: <pull.915.git.git.1605388687554.gitgitgadget@gmail.com> (raw)

From: Javier Spagnoletti <phansys@gmail.com>

Since the original tests cases were using other detectable keywords (like
"public" or "protected"), they are able to pass even if the keywords
intended to be covered are not present.

Signed-off-by: Javier Spagnoletti <phansys@gmail.com>
---
    userdiff: php: Improved test cases used to catch "abstract" and "final"
    functions
    
    Since the original tests cases were using other detectable keywords
    (like "public" or "protected"), they are able to pass even if the
    keywords intended to be covered are not present. In the case of the test
    for "abstract" keyword, the method's body was removed in the fixture,
    since PHP doesn't allow an abstract method to have a body.
    
    Signed-off-by: Javier Spagnoletti phansys@gmail.com [phansys@gmail.com]

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-915%2Fphansys%2Fpr_864-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-915/phansys/pr_864-v1
Pull-Request: https://github.com/git/git/pull/915

 t/t4018/php-abstract-method | 5 ++++-
 t/t4018/php-final-method    | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/t/t4018/php-abstract-method b/t/t4018/php-abstract-method
index ce215df75a..14d77e6c15 100644
--- a/t/t4018/php-abstract-method
+++ b/t/t4018/php-abstract-method
@@ -1,7 +1,10 @@
 abstract class Klass
 {
-    abstract public function RIGHT(): ?string
+    abstract function RIGHT(): ?string
     {
+        // PHP doesn't allow abstract methods to have a body,
+        // but this is here just for diff ckeck purposes.
+
         return 'ChangeMe';
     }
 }
diff --git a/t/t4018/php-final-method b/t/t4018/php-final-method
index 537fb8ad9a..f7dd2dec17 100644
--- a/t/t4018/php-final-method
+++ b/t/t4018/php-final-method
@@ -1,6 +1,6 @@
 class Klass
 {
-    final public function RIGHT(): string
+    final function RIGHT(): string
     {
         return 'ChangeMe';
     }

base-commit: e31aba42fb12bdeb0f850829e008e1e3f43af500
-- 
gitgitgadget

             reply	other threads:[~2020-11-14 21:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-14 21:18 Javier Spagnoletti via GitGitGadget [this message]
2020-11-14 23:46 ` [PATCH] userdiff: php: Improved tests catching "abstract" and "final" functions Johannes Sixt
2020-11-16 22:21 ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.915.git.git.1605388687554.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=phansys@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).