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

Php​Spec Snippets

by peterjmit ST2/ST3

Autocompletion to speed up writing PhpSpec examples in Sublime Text

Details

Installs

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

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.

PhpSpec snippet demo

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)