Commit dddd5f09 authored by Taddeus Kroes's avatar Taddeus Kroes

Changed project name to 'WebBasics'.

parent 5c420197
-------
Summary
-------
BasicWeb is a set of classes that provides the minimal functionalities of a
WebBasics is a set of classes that provides the minimal functionalities of a
website. The core exists of a class autoloader, a template parser, a logger
and some array manipulation functions. No MVC 'model' implementation is
included, there are already many of these out there (PHPActiveRecord is
......
......@@ -7,7 +7,7 @@
* @date 13-07-2012
*/
namespace BasicWeb;
namespace WebBasics;
require_once 'base.php';
......@@ -51,7 +51,7 @@ require_once 'base.php';
* $baz = new Baz(); // Throws a FileNotFoundError, since 'other_classes/baz.php' does not exist
* </code>
*
* @package BasicWeb
* @package WebBasics
*/
class Autoloader extends Base {
/**
......
<?php
/**
* Commonly used classes used in the BasicWeb package.
* Commonly used classes used in the WebBasics package.
*
* @author Taddeus Kroes
* @version 1.0
* @date 13-07-2012
*/
namespace BasicWeb;
namespace WebBasics;
require_once 'logger.php';
/**
* Base class for instantiable classes in the BasicWeb package.
* Base class for instantiable classes in the WebBasics package.
*
* The base class defines a static 'create' method that acts as a chainable
* shortcut for the class constructor:
......@@ -37,7 +37,7 @@ require_once 'logger.php';
* $foo->method();
* </code>
*
* @package BasicWeb
* @package WebBasics
*/
abstract class Base {
/**
......@@ -60,7 +60,7 @@ abstract class Base {
/**
* Exception, thrown when a required file does not exist.
*
* @package BasicWeb
* @package WebBasics
*/
class FileNotFoundError extends \RuntimeException {
/**
......@@ -85,7 +85,7 @@ class FileNotFoundError extends \RuntimeException {
*
* @param string $format The string to format.
* @param array $params An associative array with parameters that are used in $format.
* @package BasicWeb
* @package WebBasics
*/
function asprintf($format, array $params) {
return preg_replace_callback(
......
......@@ -7,14 +7,14 @@
* @date 13-07-2012
*/
namespace BasicWeb;
namespace WebBasics;
/**
* Logger class.
*
* A Logger object provides five functions to process log messages.
*
* @package BasicWeb
* @package WebBasics
*/
class Logger {
const CRITICAL = 0;
......
......@@ -7,7 +7,7 @@
* @date 13-07-2012
*/
namespace BasicWeb;
namespace WebBasics;
require_once 'base.php';
......@@ -17,7 +17,7 @@ require_once 'base.php';
* Each tree node has a (non-unique) name, a list of variables, and zero or
* more children.
*
* @package BasicWeb
* @package WebBasics
*/
class Node extends Base {
/**
......
<?xml version="1.0" encoding="UTF-8" ?>
<phpdoc>
<title>BasicWeb documentation</title>
<title>WebBasics documentation</title>
<parser>
<default-package-name>BasicWeb</default-package-name>
<default-package-name>WebBasics</default-package-name>
<target>build/docs</target>
</parser>
<transformer>
......
......@@ -5,7 +5,7 @@
convertWarningsToExceptions="true"
stopOnError="true">
<testsuites>
<testsuite name="BasicWeb test suite">
<testsuite name="WebBasics test suite">
<directory prefix="test_" suffix=".php">tests</directory>
</testsuite>
</testsuites>
......
......@@ -8,7 +8,7 @@
* @date 14-07-2012
*/
namespace BasicWeb;
namespace WebBasics;
require_once 'base.php';
......@@ -47,7 +47,7 @@ require_once 'base.php';
* $response = $router->call_handler('/contact'); // 'This is the contact page.'
* </code>
*
* @package BasicWeb
* @package WebBasics
*/
class Router extends Base {
/**
......
......@@ -7,7 +7,7 @@
* @date 14-07-2012
*/
namespace BasicWeb;
namespace WebBasics;
require_once 'node.php';
......@@ -67,7 +67,7 @@ require_once 'node.php';
* &lt;/html&gt;
* </code>
*
* @package BasicWeb
* @package WebBasics
*/
class Template extends Node {
/**
......@@ -359,7 +359,7 @@ class Template extends Node {
/**
* Error, thrown when an error occurs during the parsing of a template file.
*
* @package BasicWeb
* @package WebBasics
*/
class ParseError extends \RuntimeException {
/**
......
<?php
require_once 'autoloader.php';
use BasicWeb\Autoloader;
use WebBasics\Autoloader;
define('PATH', 'tests/_files/');
......@@ -31,7 +31,7 @@ class AutoloaderTest extends PHPUnit_Framework_TestCase {
* @depends test_set_root_namespace
*/
function test_strip_root_namespace() {
$strip = new ReflectionMethod('BasicWeb\Autoloader', 'strip_root_namespace');
$strip = new ReflectionMethod('WebBasics\Autoloader', 'strip_root_namespace');
$strip->setAccessible(true);
$this->autoloader->set_root_namespace('Foo');
......@@ -85,7 +85,7 @@ class AutoloaderTest extends PHPUnit_Framework_TestCase {
/**
* @depends test_load_class_not_found
* @expectedException BasicWeb\FileNotFoundError
* @expectedException WebBasics\FileNotFoundError
* @expectedExceptionMessage File "tests/_files/foobar.php" does not exist.
*/
function test_load_class_not_found_error() {
......@@ -95,7 +95,7 @@ class AutoloaderTest extends PHPUnit_Framework_TestCase {
/**
* @depends test_load_class_not_found
* @expectedException BasicWeb\FileNotFoundError
* @expectedException WebBasics\FileNotFoundError
* @expectedExceptionMessage File "tests/_files/foobar.php" does not exist.
*/
function test_load_class_not_found_noerror_overwrite() {
......
......@@ -2,7 +2,7 @@
require_once 'base.php';
class BaseExtension extends BasicWeb\Base {
class BaseExtension extends WebBasics\Base {
function __construct($foo, $bar) {
$this->foo = $foo;
$this->bar = $bar;
......@@ -15,10 +15,10 @@ class BaseTest extends PHPUnit_Framework_TestCase {
}
function test_asprintf() {
$this->assertEquals(BasicWeb\asprintf('%(foo) baz', array('foo' => 'bar')), 'bar baz');
$this->assertEquals(BasicWeb\asprintf('%(foo) baz %(foo)',
$this->assertEquals(WebBasics\asprintf('%(foo) baz', array('foo' => 'bar')), 'bar baz');
$this->assertEquals(WebBasics\asprintf('%(foo) baz %(foo)',
array('foo' => 'bar')), 'bar baz bar');
$this->assertEquals(BasicWeb\asprintf('%(bar) baz %(foo)',
$this->assertEquals(WebBasics\asprintf('%(bar) baz %(foo)',
array('foo' => 'bar', 'bar' => 'foobar')), 'foobar baz bar');
}
}
......
<?php
require_once 'logger.php';
use BasicWeb\Logger;
use WebBasics\Logger;
define('NAME', 'Testlogger');
define('FORMAT', '%(level): %(message)');
......
<?php
require_once 'node.php';
use \BasicWeb\Node;
use \WebBasics\Node;
class NodeTest extends PHPUnit_Framework_TestCase {
var $autoloader;
......
<?php
require_once 'router.php';
use BasicWeb\Router;
use WebBasics\Router;
function test_handler_no_args() {
return true;
......
<?php
require_once 'template.php';
use BasicWeb\Template;
use BasicWeb\Node;
use WebBasics\Template;
use WebBasics\Node;
define('TEMPLATES_DIR', 'tests/_files/templates/');
......@@ -33,7 +33,7 @@ class TemplateTest extends PHPUnit_Framework_TestCase {
}
/**
* @expectedException BasicWeb\FileNotFoundError
* @expectedException WebBasics\FileNotFoundError
* @expectedExceptionMessage Directory "non_existing_folder/" does not exist.
*/
function test_add_root_failure() {
......@@ -41,7 +41,7 @@ class TemplateTest extends PHPUnit_Framework_TestCase {
}
function assert_include_path_equals($expected) {
$include_path = new ReflectionProperty('BasicWeb\Template', 'include_path');
$include_path = new ReflectionProperty('WebBasics\Template', 'include_path');
$include_path->setAccessible(true);
$this->assertEquals($expected, $include_path->getValue());
}
......@@ -146,7 +146,7 @@ class TemplateTest extends PHPUnit_Framework_TestCase {
/**
* @depends test_parse_blocks_blocks
* @expectedException BasicWeb\ParseError
* @expectedException WebBasics\ParseError
* @expectedExceptionMessage Parse error in file tests/_files/templates/unexpected_end.tpl, line 5: unexpected {end}
*/
function test_parse_blocks_unexpected_end() {
......@@ -155,7 +155,7 @@ class TemplateTest extends PHPUnit_Framework_TestCase {
/**
* @depends test_parse_blocks_blocks
* @expectedException BasicWeb\ParseError
* @expectedException WebBasics\ParseError
* @expectedExceptionMessage Parse error in file tests/_files/templates/missing_end.tpl, line 6: missing {end}
*/
function test_parse_blocks_missing_end() {
......@@ -206,7 +206,7 @@ class TemplateTest extends PHPUnit_Framework_TestCase {
}
function assert_replaces($expected, $variable) {
$rm = new ReflectionMethod('BasicWeb\Template', 'replace_variable');
$rm = new ReflectionMethod('WebBasics\Template', 'replace_variable');
$rm->setAccessible(true);
$this->assertEquals($expected, $rm->invoke(null, $variable, $this->data));
}
......@@ -255,7 +255,7 @@ class TemplateTest extends PHPUnit_Framework_TestCase {
}
/*function assert_block_renders($expected_file, $block, $data) {
$rm = new ReflectionMethod('BasicWeb\Template', 'render_block');
$rm = new ReflectionMethod('WebBasics\Template', 'render_block');
$rm->setAccessible(true);
$expected_file = "tests/_files/rendered/$expected_file.html";
$this->assertStringEqualsFile($expected_file, $rm->invoke(null, $block, $data));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment