Skip to content

Latest commit

 

History

History
71 lines (53 loc) · 1.07 KB

phpunit.md

File metadata and controls

71 lines (53 loc) · 1.07 KB

PHPUnit snippets for vim

All shortcuts start with the pu prefix and are both short and intuitive:

Classes

putest

<?php

namespace AlgoTech\MainBundle\Tests;

/**
 * Class: CustomTest
 *
 * @see https://phpunit.de/manual/4.5/en/writing-tests-for-phpunit.html
 * @see \PHPUnit_Framework_TestCase
 */
class CustomTest extends \PHPUnit_Framework_TestCase
{

}

Mockings

pumock

$this
    ->getMockBuilder('Class')
    ->setMethods(array())
    ->disableOriginalConstructor()
    ->getMock()

pumockpartial

$this
    ->getMockBuilder('Class')
    ->setConstructorArgs(array())
    ->setMethods(array())
    ->getMock()

Expectations

puexpects

->expects($this->once())
->method('method')
->with($this->equalTo('something'))
->will($this->returnValue(null))

puexpectsat

->expects($this->at(0))
->method('method')
->with($this->equalTo('something'))
->will($this->returnValue(null))