ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Php​Spec Snippets

by peterjmit ALL

Autocompletion to speed up writing PhpSpec examples in Sublime Text

Details

Installs

  • Total 14K
  • Win 10K
  • Mac 2K
  • Linux 2K
Dec 27 Dec 26 Dec 25 Dec 24 Dec 23 Dec 22 Dec 21 Dec 20 Dec 19 Dec 18 Dec 17 Dec 16 Dec 15 Dec 14 Dec 13 Dec 12 Dec 11 Dec 10 Dec 9 Dec 8 Dec 7 Dec 6 Dec 5 Dec 4 Dec 3 Dec 2 Dec 1 Nov 30 Nov 29 Nov 28 Nov 27 Nov 26 Nov 25 Nov 24 Nov 23 Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12
Windows 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1
Mac 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Sublime PhpSpec Snippets

Make writing PhpSpec examples and matchers in your Specs a little easier in Sublime Text 2 & 3.

Installation

This plugin is available as a sublime package search for “PhpSpec Snippets”.

Alternatively clone this repository into your Packages/ folder.

Usage

Currently this plugin provides a command to help writing examples with PhpSpec and severals snippets to use.

Complete example command

I hate typing underscores, and I wrote this command to ease that pain. It can be accessed in two ways:

  • Open the command panel and type “PhpSpec: complete example”
  • Right click and select “PhpSpec: complete example”

The plugin will take the text from the current line and transform it into a PhpSpec example. You can also create examples over multiple lines.

The snippet generator doesn't care if you include or leave out the function declaration and/or it_/its_, the generated example will prepend those automatically.

Shortcuts

SUS Constructor

bct BeConstructedThrough.

beConstructedThrough('',array());

bcw BeConstructedWith.

beConstructedWith();

Let & Let go

let Setup method for phpspec.

function let()
{
}

letgo Teardown method for phpspec.

function letgo()
{
}

Matchers

sb shouldBe.

shouldBe();

snb shouldNotBe.

shouldNotBe();

sbi shouldBeAnInstanceOf.

shouldBeAnInstanceOf();

snbi shouldNotBeAnInstanceOf.

shouldNotBeAnInstanceOf();

sbl shouldBeLike.

shouldBeLike();

snbl shouldNotBeLike.

shouldNotBeLike();

se shouldEqual.

shouldBeEqual();

sne shouldNotEqual.

shouldNotEqual();

sht shouldHaveType.

shouldHaveType();

snht shouldNotHaveType.

shouldNotHaveType();

si shouldImplement.

shouldImplement();

sni shouldNotImplement.

shouldNotImplement();

sr shouldReturn.

shouldReturn();

snr shouldNotReturn.

shouldNotReturn();

st shouldThrow.

shouldThrow('')->during();

Stubs, Mocks and spies

wr willReturn.

willReturn();

wt willThrow.

willThrow();

sbc shouldBeCalled.

shouldBeCalled();

bnbc shouldNotBeCalled.

shouldNotBeCalled();

bhbc shouldHaveBeenCalled.

shouldHaveBeenCalled();

snhbc shouldNotHaveBeenCalled.

shouldNotHaveBeenCalled();

TODO

  • Fix code for positioning cursor (it's a bit tempremental)