sublime-phpunit
sublime-phpunit copied to clipboard
phpunit not found
Hi,
Thanks for this great plugin, I installed it but it didn't work and always gave me
PHPUnit: phpunit not found
and I don't know why!, so I traced plugin.py
to figure out what happened, the composer
variable always assigned to Null
, so I knew it can't read the default plugin configurations.
def get_phpunit_executable(self, working_dir):
composer = self.view.settings().get('phpunit.composer')
return _get_phpunit_executable(working_dir, composer)
I moved phpunit.composer
to my setting and the plugin works finally.
If you can please search why the function can't read the default plugin configurations that will be awesome.
Sorry I don't know Python I'm a PHP guy xD
Thanks again for your effort.
The default for the phpunit.composer
setting should be true.
It's hard to know why the default is not being loaded. I can't reproduce the issue. I'd need a lot more information. For example, using the console Menu > View > Show Console, what do the following show:
>>> sublime.active_window().active_view().settings().get('phpunit.composer')
True
>>> sublime.load_settings('Preferences.sublime-settings').get('phpunit.composer')
True
If you've installed manually via git, edit the default settings file in PHPUnitKit/Preferences.sublime-settings
and run the commands above again to see that the values change correctly.
Usually the setting has been overridden somewhere but it could be something else too.
Hello,
I installed this package with PackageControl and ran into the same issue. If I execute the above commands from the console I don't see any results at all.
>>> sublime.active_window().active_view().settings().get('phpunit.composer')
>>> sublime.load_settings('Preferences.sublime-settings').get('phpunit.composer')
Adding phpunit.composer
to my own settings file fixed the issue for me as well.
@gerardroche I'm sorry I was so busy in the last days, and even forgot the question :confused: , but as @matt-allan said it returns nothing. I don't know why, but when you move your configuration to your sublime setting it works.
Install it from PackageControl
and try it, my OS is Ubuntu 19.04
, and my Sublime version is 3.2.1
.
I hope this helps.
Hmm. I can't reproduce the issue.
I've added extra logging in the latest release (it will be available from Package Control soon).
If it's possible try post some logging and maybe I can see something that may be causing it.
Show the Sublime Text console log: Menu > View > Show Console.
sublime.log_commands(True); sublime.log_input(True)
To enable plugin debugging on Unix:
$ SUBLIME_PHPUNIT_DEBUG=y subl
and on Windows:
> set SUBLIME_PHPUNIT_DEBUG=y& "C:\Program Files\Sublime Text 3\subl.exe"
startup, version: 3207 linux x64 channel: stable
executable: /home/code/sublime_text_3/sublime_text
working dir: /
packages path: /home/code/.config/sublime-text-3/Packages
state path: /home/code/.config/sublime-text-3/Local
zip path: /home/code/sublime_text_3/Packages
zip path: /home/code/.config/sublime-text-3/Installed Packages
ignored_packages: ["ColorSchemeUnit", "NeoVintageousTweaks", "Six", "ToggleNeoVintageous", "Vintage", "Vintageous", "Wrap Plus"]
pre session restore time: 0.171702
startup time: 0.286673
first paint time: 0.305784
reloading plugin Default.arithmetic
reloading plugin Default.auto_indent_tag
reloading plugin Default.block
reloading plugin Default.colors
reloading plugin Default.comment
reloading plugin Default.convert_color_scheme
reloading plugin Default.convert_syntax
reloading plugin Default.copy_path
reloading plugin Default.detect_indentation
reloading plugin Default.echo
reloading plugin Default.exec
reloading plugin Default.fold
reloading plugin Default.font
reloading plugin Default.goto_line
reloading plugin Default.history_list
reloading plugin Default.indentation
reloading plugin Default.install_package_control
reloading plugin Default.kill_ring
reloading plugin Default.mark
reloading plugin Default.new_templates
reloading plugin Default.open_context_url
reloading plugin Default.open_in_browser
reloading plugin Default.pane
reloading plugin Default.paragraph
reloading plugin Default.paste_from_history
reloading plugin Default.profile
reloading plugin Default.quick_panel
reloading plugin Default.rename
reloading plugin Default.run_syntax_tests
reloading plugin Default.save_on_focus_lost
reloading plugin Default.scroll
reloading plugin Default.set_unsaved_view_name
reloading plugin Default.settings
reloading plugin Default.show_scope_name
reloading plugin Default.side_bar
reloading plugin Default.sort
reloading plugin Default.switch_file
reloading plugin Default.symbol
reloading plugin Default.transform
reloading plugin Default.transpose
reloading plugin Default.ui
reloading plugin CSS.css_completions
reloading plugin Diff.diff
reloading plugin HTML.encode_html_entities
reloading plugin HTML.html_completions
reloading plugin ShellScript.ShellScript
reloading plugin 0_package_control_loader.00-package_control
reloading plugin 0_package_control_loader.01-pygments
reloading plugin 0_package_control_loader.15-coverage
reloading plugin 0_package_control_loader.50-pymdownx
reloading plugin 0_package_control_loader.50-python-markdown
reloading plugin 0_package_control_loader.50-pyyaml
reloading plugin 0_package_control_loader.55-jsonschema
reloading plugin AutomaticPackageReloader.package_reloader
reloading plugin Origami.origami
reloading plugin Sass.sass_completions
reloading plugin SublimeLinter-contrib-mypy.linter
reloading plugin SublimeLinter-flake8.linter
reloading plugin DocBlockr.plugin
reloading plugin Markdown Preview.markdown_settings
reloading plugin Markdown Preview.markdown_wrapper
reloading plugin Markdown Preview.MarkdownPreview
reloading plugin NeoVintageous.plugin
reloading plugin Package Control.1_reloader
reloading plugin Package Control.2_bootstrap
reloading plugin Package Control.Package Control
reloading plugin PHP Completions Kit.plugin
reloading plugin PHPGrammar.plugin
reloading plugin PHPSnippets.plugin
reloading plugin PHPUnitKit.plugin
reloading plugin polyfill.preferences
reloading plugin polyfill.project
reloading plugin polyfill.toggles
reloading plugin polyfill.tree
reloading plugin polyfill.ui
reloading plugin Sesame.plugin
reloading plugin SublimeLinter.__init__
reloading plugin SublimeLinter.active_linters_view
reloading plugin SublimeLinter.busy_indicator_view
reloading plugin SublimeLinter.goto_commands
reloading plugin SublimeLinter.highlight_view
reloading plugin SublimeLinter.log_handler
reloading plugin SublimeLinter.message_view
reloading plugin SublimeLinter.panel_view
reloading plugin SublimeLinter.status_bar_view
reloading plugin SublimeLinter.sublime_linter
reloading plugin SublimeLinter-php.linter
reloading plugin SublimeLinter-php-cs-fixer.linter
reloading plugin Test.plugin
reloading plugin ToggleWords.ToggleWords
reloading plugin UnitTesting.ut
reloading plugin User.user_finders
reloading plugin User.user_git
reloading plugin User.user_man
reloading plugin User.user_neovintageous
reloading plugin User.user_open
reloading plugin User.user_phan
reloading plugin User.user_preferences
reloading plugin User.user_rulers
reloading plugin User.user_sandbox
reloading plugin User.user_scriptease
reloading plugin User.user_sublime_linter
reloading plugin User.user_syntastic
reloading plugin User.user_tasks
reloading plugin User.user_toggles
reloading plugin User.user_tree
plugins loaded
.neovintageousrc file loaded
PHPUnit: window 2 view 17 /home/code/projects/sandbox/sublime-phpunit-testing/test/File NameTest.php
PHPUnit: phpunit.run working_dir=None, file=/home/code/projects/sandbox/sublime-phpunit-testing/test/File NameTest.php, options={}
PHPUnit: find configuration for '/home/code/projects/sandbox/sublime-phpunit-testing/test/File NameTest.php'
PHPUnit: found 4 folders ['/home/code/projects/sublime-test/project1', '/home/code/projects/sublime-test/project2', '/home/code/projects/sublime-test/project2', '/home/code/projects/sandbox/sublime-phpunit-testing']
PHPUnit: found 4 ancestors ['/home/code/projects/sandbox/sublime-phpunit-testing/test', '/home/code/projects/sandbox/sublime-phpunit-testing', '/home/code/projects/sandbox', '/home/code/projects']
PHPUnit: candidate configuration files ['phpunit.xml', 'phpunit.xml.dist']
PHPUnit: found configuration '/home/code/projects/sandbox/sublime-phpunit-testing/phpunit.xml'
PHPUnit: working dir '/home/code/projects/sandbox/sublime-phpunit-testing'
PHPUnit: config phpunit.composer=True
PHPUnit: get_phpunit_executable() include_composer_vendor_dir True
PHPUnit: get_phpunit_executable() /home/code/projects/sandbox/sublime-phpunit-testing/vendor/bin/phpunit (unix)
PHPUnit: phpunit executable '/home/code/projects/sandbox/sublime-phpunit-testing/vendor/bin/phpunit'
PHPUnit: window options {'no-coverage': True}
PHPUnit: view options {'no-coverage': True}
PHPUnit: options {'no-coverage': True}
PHPUnit: env {}
PHPUnit: cmd ['/home/code/projects/sandbox/sublime-phpunit-testing/vendor/bin/phpunit', '--no-coverage', 'test/File NameTest.php']
Here's the output from my machine. Would it be helpful if I removed the user preference that fixes the issue before logging?
debug logging
startup, version: 3207 linux x64 channel: stable
executable: /opt/sublime_text/sublime_text
working dir: /
packages path: /home/matt/.config/sublime-text-3/Packages
state path: /home/matt/.config/sublime-text-3/Local
zip path: /opt/sublime_text/Packages
zip path: /home/matt/.config/sublime-text-3/Installed Packages
ignored_packages: []
pre session restore time: 0.0918858
startup time: 0.149957
git: tracking working dir /home/matt/code/laravel-code-style
first paint time: 0.1772
reloading plugin Default.arithmetic
reloading plugin Default.auto_indent_tag
reloading plugin Default.block
reloading plugin Default.colors
reloading plugin Default.comment
reloading plugin Default.convert_color_scheme
reloading plugin Default.convert_syntax
reloading plugin Default.copy_path
reloading plugin Default.detect_indentation
reloading plugin Default.echo
reloading plugin Default.exec
reloading plugin Default.fold
reloading plugin Default.font
reloading plugin Default.goto_line
reloading plugin Default.history_list
reloading plugin Default.indentation
reloading plugin Default.install_package_control
reloading plugin Default.kill_ring
reloading plugin Default.mark
reloading plugin Default.new_templates
reloading plugin Default.open_context_url
reloading plugin Default.open_in_browser
reloading plugin Default.pane
reloading plugin Default.paragraph
reloading plugin Default.paste_from_history
reloading plugin Default.profile
reloading plugin Default.quick_panel
reloading plugin Default.rename
reloading plugin Default.run_syntax_tests
reloading plugin Default.save_on_focus_lost
reloading plugin Default.scroll
reloading plugin Default.set_unsaved_view_name
reloading plugin Default.settings
reloading plugin Default.show_scope_name
reloading plugin Default.side_bar
reloading plugin Default.sort
reloading plugin Default.switch_file
reloading plugin Default.symbol
reloading plugin Default.transform
reloading plugin Default.transpose
reloading plugin Default.ui
reloading plugin CSS.css_completions
reloading plugin Diff.diff
reloading plugin HTML.encode_html_entities
reloading plugin HTML.html_completions
reloading plugin ShellScript.ShellScript
reloading plugin Vintage.vintage
reloading plugin Vintage.vintage_commands
reloading plugin Vintage.vintage_motions
reloading plugin 0_package_control_loader.00-package_control
reloading plugin 0_package_control_loader.01-pygments
reloading plugin 0_package_control_loader.10-golangconfig
reloading plugin 0_package_control_loader.10-shellenv
reloading plugin 0_package_control_loader.20-newterm
reloading plugin 0_package_control_loader.20-package_events
reloading plugin 0_package_control_loader.50-markupsafe
reloading plugin 0_package_control_loader.50-pymdownx
reloading plugin 0_package_control_loader.50-python-markdown
reloading plugin 0_package_control_loader.50-pyyaml
reloading plugin 0_package_control_loader.51-python-jinja2
reloading plugin 0_package_control_loader.55-mdpopups
reloading plugin All Autocomplete.all_views_completions
reloading plugin Delete Current File.DeleteCurrentFile
reloading plugin DocBlockr.jsdocs
reloading plugin EditorConfig.EditorConfig
reloading plugin Golang Build.golang_build
reloading plugin LSP.boot
reloading plugin Package Control.1_reloader
reloading plugin Package Control.2_bootstrap
reloading plugin Package Control.Package Control
reloading plugin PhpNamespace.classes
reloading plugin PhpNamespace.namespaces
reloading plugin PhpNamespace.PhpNamespaceCopy
reloading plugin PhpNamespace.utils
reloading plugin Quick File Creator.SublimeQuickFileCreator
reloading plugin Sass.sass_completions
reloading plugin SqlBeautifier.sqlbeautifier
reloading plugin PHPUnitKit.plugin
reloading plugin Pretty JSON.PrettyJson
reloading plugin Pretty JSON.PrettyJsonListeners
reloading plugin TypeScript.main
2019-09-29 22:24:32,534: 140496802927744: WARNING: TypeScript plugin initialized.
plugins loaded
lang_service_enabled: True
Path of tsserver.js: /home/matt/.config/sublime-text-3/Packages/TypeScript/tsserver/tsserver.js
Path of tsc.js: /home/matt/.config/sublime-text-3/Packages/TypeScript/tsserver/tsc.js
Trying to spawn node executable from: /usr/bin/node
ref view not found
Package Control: Skipping automatic upgrade, last run at 2019-09-29 21:53:29, next run at 2019-09-29 22:53:29 or after
>>> sublime.log_commands(True); sublime.log_input(True)
command: drag_select {"event": {"button": 1, "x": 676.1484375, "y": 346.552612305}}
key evt: shift+control+p
command: show_overlay {"overlay": "command_palette"}
chr evt: n (0x6e)
chr evt: e (0x65)
chr evt: a (0x61)
chr evt: r (0x72)
PHPUnit: window 2 view 14 /home/matt/code/laravel-code-style/tests/FormattingTest.php
PHPUnit: phpunit.run working_dir=None, file=/home/matt/code/laravel-code-style/tests/FormattingTest.php, options={'filter': '::(test_formatting_matches_laravel)( with data set .+)?$'}
PHPUnit: find configuration for '/home/matt/code/laravel-code-style/tests/FormattingTest.php'
PHPUnit: found 1 folders ['/home/matt/code/laravel-code-style']
PHPUnit: found 2 ancestors ['/home/matt/code/laravel-code-style/tests', '/home/matt/code/laravel-code-style']
PHPUnit: candidate configuration files ['phpunit.xml', 'phpunit.xml.dist']
PHPUnit: found configuration '/home/matt/code/laravel-code-style/phpunit.xml.dist'
PHPUnit: working dir '/home/matt/code/laravel-code-style'
PHPUnit: config phpunit.composer=True
PHPUnit: get_phpunit_executable() include_composer_vendor_dir True
PHPUnit: get_phpunit_executable() /home/matt/code/laravel-code-style/vendor/bin/phpunit (unix)
PHPUnit: phpunit executable '/home/matt/code/laravel-code-style/vendor/bin/phpunit'
PHPUnit: window options {}
PHPUnit: view options {}
PHPUnit: options {'filter': '::(test_formatting_matches_laravel)( with data set .+)?$'}
PHPUnit: env {}
PHPUnit: cmd ['/home/matt/code/laravel-code-style/vendor/bin/phpunit', '--filter', '::(test_formatting_matches_laravel)( with data set .+)?$', 'tests/FormattingTest.php']
command: show_panel {"panel": "console", "toggle": true}
command: paste_selection_clipboard {"event": {"button": 3, "x": 259.418457031, "y": 666.38684082}}
command: drag_select {"event": {"button": 1, "x": 301.184692383, "y": 655.846862793}}
key evt: control+a
command: select_all
Yes please remove the fix and paste the log. The above log looks good I can see that the composer setting is set to true: config phpunit.composer=True
and everything else looks ok.
Aswell as debug information, to see the state of of the phpunit.composer
setting on the various objects try:
>>> sublime.active_window().settings().get('phpunit.composer')
>>> sublime.active_window().active_view().settings().get('phpunit.composer')
>>> sublime.load_settings('Preferences.sublime-settings').get('phpunit.composer')
Hi,
Thanks for this great plugin, I installed it but it didn't work and always gave me
PHPUnit: phpunit not found
and I don't know why!, so I traced
plugin.py
to figure out what happened, thecomposer
variable always assigned toNull
, so I knew it can't read the default plugin configurations.def get_phpunit_executable(self, working_dir): composer = self.view.settings().get('phpunit.composer') return _get_phpunit_executable(working_dir, composer)
I moved
phpunit.composer
to my setting and the plugin works finally.If you can please search why the function can't read the default plugin configurations that will be awesome.
Sorry I don't know Python I'm a PHP guy xD
Thanks again for your effort.
Thanks for this! recently updated to Sublime 4 and installed this package. It wasn't working. The default settings show that phpunit.composer is set to true but it didn't work until i copied that to my user settings. Thanks a lot!
Overriding in the user setting probably means that something is blocking or overriding the default setting. Sometimes this can happen if a settings file get corrupted, perhaps during an update. Again, clearing caches, or reinstalling the plugin and restarting can work.
These type of issues are incredibly difficult to reproduce. Until I can reproduce the issues I won't be able to find fix or workaround so closing for now, but if you encounter it again and can reproduce it let me know.