- Two standard controllers -- PageController and TestsController

- Helpers for controllers -- each controller has it's own helper in the /app/helpers directory
- /logs and /modules directories
- The application runs just fine without /config/database.php if controllers don't ask for db access
- Changed the name of /public/dispatch.php to /public/index.php, it's nicer and more standard, won't you agree? Kamil's fix for no-mod_rewrite needs to be re-implemented
- Cleanups, fixes, and even one or two comments ;)

git-svn-id: https://svn.cakephp.org/repo/trunk/cake@158 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
pies 2005-05-22 23:24:09 +00:00
parent 3dd8d77b09
commit 4a87a75332
47 changed files with 5096 additions and 4748 deletions

View file

@ -0,0 +1,22 @@
<?PHP
class PagesController extends PagesHelper {
function view () {
if (!func_num_args())
$this->redirect('/');
$path = func_get_args();
if (!count($path))
$this->redirect('/');
$this->set('page', $path[0]);
$this->set('subpage', empty($path[1])? null: $path[1]);
$this->set('title', ucfirst($path[count($path)-1]));
$this->render(join('/', $path));
}
}
?>

View file

@ -0,0 +1,43 @@
<?PHP
uses('test', 'folder', 'inflector');
class TestsController extends TestsHelper {
function test_all () {
$this->layout = 'test';
$tests_folder = new Folder('../tests');
$results = array();
$total_errors = 0;
foreach ($tests_folder->findRecursive('.*\.php') as $test) {
if (preg_match('/^(.+)\.php/i', basename($test), $r)) {
require_once($test);
$test_name = Inflector::Camelize($r[1]);
if (preg_match('/^(.+)Test$/i', $test_name, $r)) {
$module_name = $r[1];
}
else {
$module_name = $test_name;
}
$suite = new TestSuite($test_name);
$result = TestRunner::run($suite);
$total_errors += $result['errors'];
$results[] = array(
'name'=>$module_name,
'result'=>$result,
);
}
}
$this->set('success', !$total_errors);
$this->set('results', $results);
}
}
?>

View file

@ -8,6 +8,8 @@
<body>
<h1><?=$title_for_layout?></h1>
<?=$content_for_layout?>
</body>

View file

@ -0,0 +1,91 @@
<html>
<head>
<style type="text/css"><!--
BODY {
font:normal .9em Arial,sans-serif;
color:Black;
}
TABLE {
margin-left:3em;
border-collapse:collapse;
border:2px solid #DDD;
}
TH, TD {
font:normal .8em Tahoma, sans-serif;
}
TH {
text-align:left;
padding:.4em .3em .1em .3em;
}
TH B {
font:bold 1.2em Arial,sans-serif;
}
TD {
padding:.1em .55em;
}
TR.fail TD {
font-weight:bold;
color:#FFF;
background-color:#F31;
}
TR.info TD {
background-color:#F8F8F8;
padding:.5em 1em .5em 2em;
}
TR.info .ok {
color:Green;
}
TR.info .not {
color:Red;
}
TR.info EM {
color:Gray;
font-style:normal;
}
TR.unkn TD {
background-color:#FF0;
}
TR.pass TD, TR.expected TD {
color:Green;
}
CODE {
font-size:1.2em;
}
CODE.expected {
color: green;
}
CODE.actual {
color: red;
}
.typeinfo {
color: gray;
}
.box {
font-size:3em;
text-align:center;
margin-top:1em;
}
.box B {
color:#FFF;
padding:.3em .6em;
background-color:#BBB;
}
#ok B {
background-color:#82AF15;
}
#error B {
background-color:#C2361B;
}
--></style>
<body>
<?=$content_for_layout?>
</body>
</html>

View file

@ -0,0 +1,27 @@
<h2>Cake works!</h2>
<p>Your installation of Cake is functional. Edit <code>/app/views/pages/home.thtml</code> to change the contents of this page.</p>
<h2>Introducing Cake</h2>
<p>Cake is a structure of libraries, classes and run-time infrastructure for PHP programmers. It's also what I use at work. It's based on certain conventions, so you may find it rigid at first. The directory structure is already layed out, and it's different from what most people use. From what I've experienced, great many PHP programmers start as web- or graphic-designers, i.e. they are not university-educated programmers as many in the C++ and Java-land. They invent their own, peculiar ways of solving problems and stick to them. Perhaps that's why so few people use Pear and Pecl libraries &ndash; they don't usually re-use their code. And I was one of them. (<?=$this->linkOut('continued...','http://sputnik.pl/docs/intro')?>)</p>
<h2>Features</h2>
<p><ul>
<li>compatibile with PHP4 and PHP5</li>
<li>supplies integrated <acronym title="Create, Read, Update, Delete">CRUD</acronym> for database and simplified querying so you shouldn't need to write SQL for basic operations (although <em>some</em> familiarity with SQL is strongly recommended)</li>
<li>request dispatcher with good looking, custom URLs</li>
<li>fast, flexible templating (PHP syntax with helper methods)</li>
<li>works from a website subdirectory, with very little Apache configuration involved (requires <code>.htaccess</code> files and <code>mod_rewrite</code> to work; these are available on most web servers)</li>
</ul></p>
<p>Cake is in it's early infancy, but it works and I'm using it on a few projects. Currently the Dispatcher is working, the Model has <acronym title="Create, Read, Update, Delete">CRUD</acronym> functionality but with no joins between tables yet. The Controller is working and has the most basic functions (including <code>render()</code> for templating).</p>
<h2>Getting involved</h2>
<p><b>NEW! <?=$this->linkOut('My Amazon Wishlish','http://www.amazon.com/gp/registry/registry.html?id=NODP8QT6LFTO')?></b> for when you'll want to show your appreciation.</p>
<p><?=$this->linkOut('Cake PHP Google Group','http://groups-beta.google.com/group/cake-php')?> &middot; <?=$this->linkOut('Cake Wiki (temporary)','http://cake.bplusf.net/')?> &middot; <?=$this->linkOut('Cake TRAC (SVN repository, etc.)','https://developers.nextco.com/cake')?><a href=""></a></p>
<p>See <?=$this->linkOut('Cake website','http://sputnik.pl/cake')?> for more information.</p>

View file

@ -0,0 +1,29 @@
<?PHP if ($success) { ?>
<p class="box" id="ok"><b>PASSED</b></p>
<?PHP } else { ?>
<p class="box" id="error"><b>FAILED</b></p>
<?PHP } ?>
<table>
<?PHP foreach ($results as $r) {
$performed = $r['result']['tests'];
if ($performed||1) {
?>
<tr><th><b><?=$r['name']?></b> <?=$performed?> test<?=$performed==1?'':'s'?></th></tr>
<?PHP if ($r['result']['tests']) {
foreach ($r['result']['details'] as $detail) {
if ($detail['failed']) { ?>
<tr class="fail"><td><?=$r['name']?>::<?=$detail['method']?></td></tr>
<?PHP foreach ($detail['errors'] as $error) { ?>
<tr class="info"><td>
<span class="ok"><?=$error['expected'][0]?></span> <em><?=$error['expected'][1]?></em><br />
<span class="not"><?=$error['actual'][0]?></span> <em><?=$error['actual'][1]?></em>
</td></tr>
<?PHP
}
}
else { ?>
<tr class="pass"><td><?=$r['name']?>::<?=$detail['method']?></td></tr>
<?PHP } } } } } ?>
</table>

View file

@ -36,6 +36,6 @@
* - 1: development
* - 2: full debug with sql
*/
define ('DEBUG', 0);
define ('DEBUG', 1);
?>

View file

@ -73,7 +73,15 @@ define ('CONFIGS', ROOT.'config'.DS);
* Path to the libs directory.
*/
define ('LIBS', ROOT.'libs'.DS);
/**
* Path to the logs directory.
*/
define ('LOGS', ROOT.'logs'.DS);
/**
* Path to the modules directory.
*/
define ('MODULES', ROOT.'modules'.DS);
/**

View file

@ -36,7 +36,7 @@
* Here, we are connecting '/' (base path) to controller called 'Pages', and
* its action called 'index' - note there are no additional params passed.
*/
$Route->connect ('/', array('controller'=>'Pages', 'action'=>'index'));
$Route->connect ('/', array('controller'=>'Pages', 'action'=>'view', 'home'));
/**
* Here we connect url '/test' to our test controller. This is helpfull in
@ -44,4 +44,10 @@ $Route->connect ('/', array('controller'=>'Pages', 'action'=>'index'));
*/
$Route->connect ('/test', array('controller'=>'Tests', 'action'=>'test_all'));
/**
* Now we connect the rest of Pages controller's urls
* This needs to be the last one, as it takes in any and all remaining urls
*/
$Route->connect ('/*', array('controller'=>'Pages', 'action'=>'view'));
?>

View file

@ -1,4 +1,4 @@
<?php
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
@ -28,15 +28,20 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Get Cake's root directory
*/
define ('DS', DIRECTORY_SEPARATOR);
define ('ROOT', dirname(__FILE__).DS);
/**
* We need to redefine some constants and variables, so that Cake knows it is
* working without mod_rewrite.
*/
define ('BASE_URL', $_SERVER['SCRIPT_NAME']);
define ('ROOT', dirname($_SERVER['SCRIPT_FILENAME']).'/');
$_GET['url'] = ltrim($_SERVER['PATH_INFO'],'/');
require ROOT.'public/dispatch.php';
require (ROOT.'public/dispatch.php');
?>

View file

@ -149,6 +149,9 @@ class %sTest extends TestCase {
$this->stdout = fopen('php://stdout', 'w');
$this->stderr = fopen('php://stderr', 'w');
// Output directory name
fwrite($this->stderr, "\n".substr(ROOT,0,strlen(ROOT)-1).":\n".str_repeat('-',strlen(ROOT)+1)."\n");
switch ($type) {
case 'model':
@ -201,10 +204,10 @@ class %sTest extends TestCase {
*/
function newView ($controller, $name) {
$dir = Inflector::underscore($controller);
$path = "{$dir}/".strtolower($name).".thtml";
$path = $dir.DS.strtolower($name).".thtml";
$this->createDir(VIEWS.$dir);
$fn = VIEWS.$path;
$this->createFile($fn, sprintf($this->template('view'), "<p>Edit <b>app/views/{$path}</b> to change this message.</p>"));
$this->createFile($fn, sprintf($this->template('view'), "<p>Edit <b>app".DS."views".DS."{$path}</b> to change this message.</p>"));
$this->actions++;
}
@ -452,9 +455,10 @@ class %sTest extends TestCase {
* @uses Bake::stderr
*/
function createFile ($path, $contents) {
$shortPath = str_replace(ROOT,null,$path);
if (is_file($path) && !$this->dontAsk) {
fwrite($this->stdout, "File {$path} exists, overwrite? (yNaq) ");
fwrite($this->stdout, "File {$shortPath} exists, overwrite? (yNaq) ");
$key = trim(fgets($this->stdin));
if ($key=='q') {
@ -467,7 +471,7 @@ class %sTest extends TestCase {
elseif ($key=='y') {
}
else {
fwrite($this->stdout, "Skip {$path}\n");
fwrite($this->stdout, "Skip {$shortPath}\n");
return false;
}
}
@ -475,12 +479,12 @@ class %sTest extends TestCase {
if ($f = fopen($path, 'w')) {
fwrite($f, $contents);
fclose($f);
fwrite($this->stdout, "Wrote {$path}\n");
fwrite($this->stdout, "Wrote {$shortPath}\n");
// debug ("Wrote {$path}");
return true;
}
else {
fwrite($this->stderr, "Error! Couldn't open {$path} for writing.\n");
fwrite($this->stderr, "Error! Couldn't open {$shortPath} for writing.\n");
// debug ("Error! Couldn't open {$path} for writing.");
return false;
}
@ -499,13 +503,15 @@ class %sTest extends TestCase {
if (is_dir($path))
return true;
$shortPath = str_replace(ROOT, null, $path);
if (mkdir($path)) {
fwrite($this->stdout, "Created {$path}\n");
fwrite($this->stdout, "Created {$shortPath}\n");
// debug ("Created {$path}");
return true;
}
else {
fwrite($this->stderr, "Error! Couldn't create dir {$path}\n");
fwrite($this->stderr, "Error! Couldn't create dir {$shortPath}\n");
// debug ("Error! Couldn't create dir {$path}");
return false;
}

View file

@ -99,7 +99,13 @@ function listClasses($path) {
function config () {
$args = func_get_args();
foreach ($args as $arg) {
if (file_exists(CONFIGS.$arg.'.php')) {
require_once (CONFIGS.$arg.'.php');
return true;
}
else {
return false;
}
}
}

View file

@ -39,11 +39,9 @@ uses('model');
/**
* Enter description here...
*
*
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
*
*/
class Cache extends Model {

View file

@ -36,7 +36,6 @@
/**
* Enter description here...
*
*/
uses('model', 'template', 'inflector');

View file

@ -266,8 +266,7 @@ class DBO extends Object {
/**
* Returns a single row of results from the _last_ query
*
* @param unknown_type $results
* @param unknown_type $type
* @param resource $res
* @return unknown
*/
function farr ($res=false) {
@ -302,7 +301,7 @@ class DBO extends Object {
}
/**
* Enter description here...
* Returns a single field of the first of query results for a given sql query
*
* @param unknown_type $name
* @param unknown_type $sql
@ -314,7 +313,7 @@ class DBO extends Object {
}
/**
* Enter description here...
* Checks if the specified table contains any record matching specified SQL
*
* @param unknown_type $table
* @param unknown_type $sql

View file

@ -45,6 +45,8 @@ uses('object');
class DboFactory extends Object {
function make ($activeConfig) {
if (!class_exists('DATABASE_CONFIG')) return false;
$config = DATABASE_CONFIG::$activeConfig();
// special case for AdoDB -- driver name in the form of 'adodb_drivername'

View file

@ -35,7 +35,7 @@
* Dispatches the request, creating aproppriate models and controllers.
*/
uses('error_messages', 'object', 'router', 'cache', 'controller');
uses('error_messages', 'object', 'router', 'controller');
/**
* Enter description here...
@ -163,10 +163,10 @@ class Dispatcher extends Object {
// if document root ends with 'public', it's probably correctly set
$r = null;
if (!ereg('/^.*/public(\/)?$/', $doc_root))
return preg_match('/^(.*)\/public\/dispatch\.php$/', $script_name, $r)? $r[1]: false;
return preg_match('/^(.*)\/public\/index\.php$/', $script_name, $r)? $r[1]: false;
// document root is probably not set to Cake 'public' dir
else
return preg_match('/^(.*)\/dispatch\.php$/', $script_name, $r)? $r[1]: false;
return preg_match('/^(.*)\/index\.php$/', $script_name, $r)? $r[1]: false;
}
/**

View file

@ -34,18 +34,15 @@
/**
* Enter description here...
*
*/
uses('object');
/**
* Enter description here...
*
*
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
*
*/
class Inflector extends Object {

View file

@ -39,4 +39,24 @@ if (version_compare(phpversion(), '5.0') < 0) {
');
}
// needed for old Plog v2
//
function old_lib ($name) {
old_libs ($name);
}
function old_libs () {
if (count($lib_names = func_get_args())) {
foreach ($lib_names as $lib_name) {
require (OLD_LIBS.$lib_name.'.php');
}
return true;
}
else {
return false;
}
}
?>

View file

@ -31,6 +31,16 @@ uses('log');
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
uses('log');
/**
* Enter description here...
*
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
*/
class Object {
/**

View file

@ -1,9 +1,13 @@
# Based on Rails 0.10.0 .htaccess (www.rubyonrails.com)
<IfModule mod_rewrite.c>
# Redirect all requests not available on the filesystem to Cake
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.php?url=$1 [QSA,L]
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
# In case Cake experiences terminal errors
ErrorDocument 500 500.html
</IfModule>

View file

@ -0,0 +1,57 @@
BODY {
font-size:.9em;
}
BODY, INPUT, TEXTAREA {
font-family:sans-serif;
}
H1 {
font-size:2.1em;
text-align:center;
}
H2 {
font-size:1.8em;
}
H3 {
font-size:1.5em;
}
P {
font-size:1em;
margin-bottom:.5em;
}
A {
white-space:nowrap;
text-decoration:underline;
}
CODE, PRE {
font-family:monospace;
font-size:1.1em !important;
font-size:.95em;
color:#44A;
margin:0;
}
CODE {
color:#227;
white-space:nowrap;
margin:0 .2em;
}
PRE {
margin-left:1em;
}
ACRONYM {
border-bottom:1px dotted;
}
HR {
height:0;
border-top:1px solid #AAA;
}

View file

@ -1,67 +0,0 @@
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + //
// + See: http://www.opensource.org/licenses/mit-license.php + //
//////////////////////////////////////////////////////////////////////////
/**
* Purpose: Dispatch
* The main "loop"
*
* @filesource
* @author Cake Authors/Developers
* @copyright Copyright (c) 2005, Cake Authors/Developers
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.public
* @since Cake v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
session_start();
/**
* Get Cake's root directory
*/
define ('DS', DIRECTORY_SEPARATOR);
define ('ROOT', substr(__FILE__, 0, strrpos(dirname(__FILE__), DS)+1));
/**
* Directory layout and basic functions
*/
require (ROOT.'config/core.php');
require (ROOT.'config/paths.php');
require (ROOT.'libs/basics.php');
DEBUG? error_reporting(E_ALL): error_reporting(0);
$TIME_START = getMicrotime();
uses ('folder', 'dispatcher', 'dbo_factory');
config ('tags', 'database');
$DB = DboFactory::make('devel');
loadModels ();
## RUN THE SCRIPT
$url = empty($_GET['url'])? null: $_GET['url'];
$DISPATCHER = new Dispatcher ();
$DISPATCHER->dispatch($url);
## CLEANUP
if (DEBUG) echo "<!-- ". round(getMicrotime() - $TIME_START, 2) ."s -->";
?>

View file

@ -1,4 +1,4 @@
<?php
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
@ -14,7 +14,8 @@
//////////////////////////////////////////////////////////////////////////
/**
* Enter description here...
* Purpose: Dispatch
* The main "loop"
*
* @filesource
* @author Cake Authors/Developers
@ -29,9 +30,38 @@
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
session_start();
/**
* Enter description here...
*
* Get Cake's root directory
*/
header ('dispatch.php?url='.ltrim($_SERVER['PATH_INFO'],'/'));
define ('DS', DIRECTORY_SEPARATOR);
define ('ROOT', dirname(dirname(__FILE__)).DS);
/**
* Directory layout and basic functions
*/
require (ROOT.'config/core.php');
require (ROOT.'config/paths.php');
require (ROOT.'libs/basics.php');
DEBUG? error_reporting(E_ALL): error_reporting(0);
$TIME_START = getMicrotime();
uses ('folder', 'dispatcher', 'dbo_factory');
config ('tags', 'database');
$DB = DboFactory::make('devel');
loadModels ();
## RUN THE SCRIPT
$url = empty($_GET['url'])? null: $_GET['url'];
$DISPATCHER = new Dispatcher ();
$DISPATCHER->dispatch($url);
## CLEANUP
if (DEBUG) echo "<!-- ". round(getMicrotime() - $TIME_START, 2) ."s -->";
?>

View file

@ -0,0 +1,37 @@
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + //
// + See: http://www.opensource.org/licenses/mit-license.php + //
//////////////////////////////////////////////////////////////////////////
/**
* Enter description here...
*
* @filesource
* @author Cake Authors/Developers
* @copyright Copyright (c) 2005, Cake Authors/Developers
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.public
* @since Cake v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Re-routes the request to dispatch.php
*/
include('dispatch.php')
// header ('dispatch.php?url='.ltrim($_SERVER['PATH_INFO'],'/'));
?>

View file

@ -1 +0,0 @@
@php -q scripts/add.php %1 %2 %3 %4 %5 %6 %7 %8 %9

1
scripts/bake.bat Normal file
View file

@ -0,0 +1 @@
@php -q add.php %1 %2 %3 %4 %5 %6 %7 %8 %9

View file

@ -34,7 +34,7 @@
* START-UP
*/
define ('DS', DIRECTORY_SEPARATOR);
define ('ROOT', substr(__FILE__, 0, strrpos(dirname(__FILE__), DS)+1));
define ('ROOT', dirname(dirname(__FILE__)).DS);
require (ROOT.'config'.DS.'paths.php');
require (LIBS.'basics.php');

View file

View file

View file

@ -26,6 +26,8 @@ class DboFactoryTest extends TestCase {
function testMake () {
if (class_exists(DATABASE_CONFIG)) {
$output = $this->abc->make('test');
$this->assertTrue(is_object($output));
@ -43,6 +45,7 @@ class DboFactoryTest extends TestCase {
$this->assertTrue($output->connected);
}
}
// this test expect an E_USER_ERROR to occur during it's run
// I've disabled it until I find a way to assert it happen

View file

@ -22,10 +22,14 @@ class DboTest extends TestCase {
// this function is defined in PHPUnit_TestCase and overwritten
// here
function tearDown() {
if (!$this->abc) return false;
$this->dropTemporaryTable();
}
function createTemporaryTable () {
if (!$this->abc) return false;
if ($this->abc->config['driver'] == 'postgres')
$sql = 'CREATE TABLE __test (id serial NOT NULL, body CHARACTER VARYING(255))';
else
@ -35,10 +39,14 @@ class DboTest extends TestCase {
}
function dropTemporaryTable () {
if (!$this->abc) return false;
return $this->abc->query("DROP TABLE __test");
}
function testHasImplementation () {
if (!$this->abc) return false;
$functions = array(
'connect',
'disconnect',
@ -59,15 +67,21 @@ class DboTest extends TestCase {
}
function testConnectivity () {
if (!$this->abc) return false;
$this->assertTrue($this->abc->connected);
}
function testFields () {
if (!$this->abc) return false;
$fields = $this->abc->fields('__test');
$this->assertEquals(count($fields), 2, 'equals');
}
function testTables () {
if (!$this->abc) return false;
$this->assertTrue(in_array('__test', $this->abc->tables()));
}
}

View file

@ -27,7 +27,7 @@ class FolderTest extends TestCase {
function testLs () {
$result = $this->abc->ls();
$expected = array(array('css', 'files', 'img'),array('.htaccess', '500.html', 'dispatch.php'));
$expected = array(array('css', 'files', 'img'),array('.htaccess', '500.html', 'index.php', 'index_no_mod_rewrite.php'));
$this->assertEquals($result, $expected);
}
@ -48,8 +48,8 @@ class FolderTest extends TestCase {
}
function testFindRecursive () {
$result = $this->abc->findRecursive('.*\.php');
$expected = array(Folder::addPathElement($this->abc->pwd(), 'dispatch.php'));
$result = $this->abc->findRecursive('.*ex\.php');
$expected = array(Folder::addPathElement($this->abc->pwd(), 'index.php'));
$this->assertEquals($result, $expected);
}

0
vendors/put_vendor_libraries_here vendored Normal file
View file