Giter VIP home page Giter VIP logo

extended_test_case's Introduction

Note: This repo is no longer under active development. These improvements were contributed to the CakePHP core in the 2.0-dev stage. Please take a look at the docs for more info. This plugin is still plenty usable for projects still on the CakePHP 1.3 branch.

Extended Test Case

Extended test case aims to make the displeasure of using CakeTestCase::testAction() slightly more pleasurable.

Usage

Above your test case, use:

App::import('Lib', 'ExtendedTestCase.ExtendedTestCase');

Then extend your test case with ExtendedTestCase instead of CakeTestCase and define the testController variable in your test case as the controller you are testing.

For more information about utilizing mocks, etc. visit here.

Another handy feature that ExtendedTestCase adds is the ability to just test certain methods. This is especially useful when you are making minor changes to one method (say, a controller method) who's test lies in a large test case that loads a lot of fixtures. While testing internally, you can conveniently add an array of methods that you want to run in a $testMethods var on your test case.

class MyTestCase extends ExtendedTestCase {
    var $testMethods = array('testThis');

    function testThis() {} // will run
    function testThat() {} // will not run
}

Since no other tests run, you'll only need to load the database and fixtures for the method you care about at the time.

Remember to remove $testMethods before you commit anything :)

Features

  • Falls back to old testAction method if ExtendedTestCase::testController is not defined
  • Allows use of mocks for things like the Email component or your controller actions (render, header, etc.) in tests
  • Simulates most of what the controller action does, minus actually rendering anything
  • Allows testing a subset of test methods within a large test case

License

Licensed under The MIT License http://www.opensource.org/licenses/mit-license.php Redistributions of files must retain the above copyright notice.

Links

extended_test_case's People

Contributors

jeremyharris avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.