Sha256: 0282a46232c39a72cf588a1d0c5b9864f45657dad12714fed409a47ff9f795d7
Contents?: true
Size: 977 Bytes
Versions: 7
Compression:
Stored size: 977 Bytes
Contents
module Koine class TestRunner class Adapters class Phpunit < BaseRegexp DEFAULT_OPTIONS = [ '--color' ].freeze def initialize(file_pattern: /.*Test.php$/, options: nil) super(file_pattern: file_pattern) @options = Array(options || DEFAULT_OPTIONS) end private def file_line_command(config) regexp = /public function ([^\(]+)/ matcher = FileMatcher.new(file_path: config.file_path) match = matcher.above_line(config.line, regexp: regexp)[1] [single_file_command(config), '--filter', "'/\\b#{match}\\b/'"].join(' ') end def script_for(_config) if File.exist?('vendor/bin/phpunit') return with_options('./vendor/bin/phpunit') end with_options('phpunit') end def with_options(script) [script, @options].flatten.join(' ') end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems