Skip to content
Open
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
8 changes: 7 additions & 1 deletion TestNameGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ def run(self, edit):

if existingMethod == False:
SublimeConnect.insertMethodName(edit, cursorLine, TextHelper.prepareTestBlockPHP(phrase, methodName))
TextHelper.closingSnippet(self.view)
else:
SublimeConnect.updateMethodNamePHP(edit, cursorLine, methodName, existingMethod)

else:
# JS will add a new test method because the text is inside the test method
SublimeConnect.insertMethodName(edit, cursorLine, TextHelper.prepareTestBlockJS(phrase))
TextHelper.closingSnippet(self.view)

class TextHelper():
def patternExistingMethodPHP(lineContents):
Expand All @@ -73,7 +75,11 @@ def patternMethodName():

def prepareTestBlockPHP(phrase, methodName):
tab = SublimeConnect.getWhitespaceTab()
return tab + "/**\n" + tab + " * " + phrase + "\n" + tab + " */\n" + tab + "public function test" + methodName + "()\n" + tab + "{\n\n" + tab + "}\n\n" + tab
return tab + "/**\n" + tab + " * " + phrase + "\n" + tab + " */\n" + tab + "public function test" + methodName + "()"

def closingSnippet(view):
view.run_command("insert_snippet", {"contents": "\n\{\n\t$5\n\}"})


# will generate Jasmine blocks
def prepareTestBlockJS(phrase):
Expand Down