Last active
February 18, 2019 18:12
-
-
Save DCzajkowski/86fb11e6e5c4aee6b9157364772799ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a file in Plugins/ | |
# You can run this via Sublime's console with: view.run_command("php_unit_test_method") | |
# You can bind it to ctrl+e as a regular command | |
import sublime | |
import sublime_plugin | |
class PhpUnitTestMethodCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
line = self.view.substr(self.view.line(self.view.sel()[0])) | |
lineSplit = line.split('it', 1) | |
self.view.replace(edit, self.view.line(self.view.sel()[0]), lineSplit[0] + '/** @test */\n' + lineSplit[0] + 'function ' + 'it' + lineSplit[1].replace(' ', '_') + '() {\n' + lineSplit[0] + ' \n' + lineSplit[0] + '}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice!