Download the PHP package ink/haphazard without Composer

On this page you can find all versions of the php package ink/haphazard. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package haphazard

Haphazard

Haphazard is a library extension to Symfony's WebTestCase that provides a quick and dirty method to functional test basic pages.

Installation

You can install Haphazard through composer:

composer.phar require ink/haphazard

Usage

Simple page load test

When all you want to test is that the page at least loads properly, you can use the HaphazardTestCase::assertGet() or HaphazardTestCase::assertPost() methods. This will create a web client and assert that a response code of 200 is returned for the page.

use Ink\Haphazard\TestCase\HaphazardTestCase;

class ProductControllerTest extends HaphazardTestCase
{
    /**
     * Test Index Action
     */
    public function testIndexAction()
    {
        $this->assertGet('index');
    }

    /**
     * Test Post Action
     */
     public function testCreatePostAction()
     {
         $this->assertPost('create');
     }
}

Page with parameters

If the page you're testing requires parameters, you can pass those in as well.

/**
 * Test View Action
 */
public function testViewAction()
{
    $this->assertGet('product-view', ['productId' => 1]);
}

/**
 * Test Edit Action
 */
 public function testEditAction()
 {
     $this->assertPost('product-edit', ['productId' => 1]);
 }

Page with a Post body

If you need to send additional parameters along with your POST request, you can send them along.

/**
 * Test Edit Action
 */
 public function testEditAction()
 {
     $this->assertPost('product-edit', ['productId' => 1], ['product-name' => 'Acme Product']);
 }

Different Status codes

Occasionally you will want to test that pages return a different status code, for example a 403 / Forbidden status code when an anonymous user should not be able to access a given page, or a 302 when the page redirects.

/**
 * Test Edit Action
 */
public function testEditAction()
{
    $this->assertGet('product-edit', ['productId' => 1], 403);
}

/**
 * Test Edit Action
 */
 public function testEditAction()
 {
     $this->assertPost('product-edit', ['productId' => 1], ['product-name' => 'Acme Product'], 302);
 }

Spoof Authentication Role

In order to effectively test that pages are open / closed to the correct users, this library provides an easy way to make assertions using a specified role.

/**
 * Test Edit Action
 */
public function testEditAction()
{
    // Allow our Admin role
    $user = new User();
    $this->login($user);
    $this->assertGet('product-edit', ['productId' => 1], 200);

    // Disallow Anonymous users
    $this->refreshClient();
    $this->assertGet('product-edit', ['productId' => 1], 403);
}

All versions of haphazard with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
symfony/symfony Version >=2.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ink/haphazard contains the following files

Loading the files please wait ....