Location: PHPKode > scripts > PHPStopFlood > phpstopflood/_tests/PHPStopFlood_BasicContainerTest.php
<?php

require_once '../Container.php';

require_once 'PHPUnit/Framework/TestCase.php';

class PHPStopFlood_ContainerTest extends PHPUnit_Framework_TestCase {

	/**
	 * @var _container
	 */
	private $_container;

	/**
	 * Prepares the environment before running a test.
	 */
	protected function setUp() {
		parent::setUp();
		$this->_container = new ContainerTest(
			array ("option1" => "option1value", "option2" => 20));
	}

	/**
	 * Cleans up the environment after running a test.
	 */
	protected function tearDown() {
		$this->_container = null;
		parent::tearDown();
	}

	public function testContainerOptions() {
		$optionsAttr = $this->getObjectAttribute($this->_container, '_options');
		$this->assertTrue($optionsAttr ['option1'] === 'option1value');
		$this->assertTrue($optionsAttr ['option2'] === 20);
	}
}

class ContainerTest extends PHPStopFlood_Container {

	protected function _setDefaults() {
	}

	protected function _initialize() {
	}

	public function read($uniqueId) {
	}

	public function write($uniqueId, array $data) {
	}

	public function gc($lifetime) {
	}

}
Return current item: PHPStopFlood