Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test and run in GitHub Actions #211

Merged
merged 1 commit into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: CI

on: [pull_request]

jobs:
run-tests:
strategy:
fail-fast: false
matrix:
st-version: [4]
# st-version: [3, 4]
# os: ["ubuntu-latest", "macOS-latest", "windows-latest"]
os: ["ubuntu-latest"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: SublimeText/UnitTesting/actions/setup@v1
with:
# Details: https://github.com/SublimeText/UnitTesting/blob/master/actions/setup/action.yaml#L19
package-name: Phpcs
sublime-text-version: ${{ matrix.st-version }}
- uses: SublimeText/UnitTesting/actions/run-tests@v1
30 changes: 30 additions & 0 deletions tests/test_phpcs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import os
import re
import sys
import sublime
from unittest import TestCase


from Phpcs.phpcs import Sniffer


class TestDiffViewInternalFunctions(TestCase):
def test_we_can_build_up_the_correct_executable_string_when_we_prefix(self):
php_path = "/bin/php"
s = sublime.load_settings("phpcs.sublime-settings")

s.set("phpcs_php_prefix_path", php_path)
s.set("phpcs_commands_to_php_prefix", "Sniffer")

args = Sniffer().get_executable_args()
self.assertIn(php_path, args)

def test_we_can_build_up_the_correct_executable_string_when_we_dont_prefix(self):
s = sublime.load_settings("phpcs.sublime-settings")

s.set("phpcs_php_prefix_path", "/bin/php")
s.set("phpcs_commands_to_php_prefix", "")
s.set("phpcs_executable_path", "")

args = Sniffer().get_executable_args()
self.assertIn("phpcs", args)
Loading