Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update fatfree app and test to support namespace F3 update made to fatfree-core in #112. #901

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "lib"]
path = lib
path = f3
url = https://github.com/bcosca/fatfree-core.git
4 changes: 2 additions & 2 deletions app/audit.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
class Audit extends Controller {

function get($f3) {
$test=new \Test;
$test=new \F3\Test;
$test->expect(
is_null($f3->get('ERROR')),
'No errors expected at this point'
);
$audit=new \Audit;
$audit=new \F3\Audit;
$test->expect(
!$audit->url('http://www.example.com/space here.html') &&
$audit->url('http://www.example.com/space%20here.html'),
Expand Down
22 changes: 11 additions & 11 deletions app/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
class Auth extends Controller {

function get($f3) {
$test=new \Test;
$test=new \F3\Test;
$test->expect(
is_null($f3->get('ERROR')),
'No errors expected at this point'
);
if (!is_dir('tmp/'))
mkdir('tmp/',\Base::MODE,TRUE);
$db=new \DB\Jig('tmp/');
mkdir('tmp/',\F3\Base::MODE,TRUE);
$db=new \F3\DB\Jig('tmp/');
$db->drop();
$user=new \DB\Jig\Mapper($db,'users');
$user=new \F3\DB\Jig\Mapper($db,'users');
$user->set('user_id','admin');
$user->set('password','secret');
$user->save();
$auth=new \Auth($user,array('id'=>'user_id','pw'=>'password'));
$auth=new \F3\Auth($user,array('id'=>'user_id','pw'=>'password'));
$test->expect(
$auth->basic(),
'HTTP basic auth mechanism'
Expand All @@ -30,13 +30,13 @@ function get($f3) {
$db->drop();
if (extension_loaded('mongo')) {
try {
$db=new \DB\Mongo('mongodb://localhost:27017','test');
$db=new \F3\DB\Mongo('mongodb://localhost:27017','test');
$db->drop();
$user=new \DB\Mongo\Mapper($db,'users');
$user=new \F3\DB\Mongo\Mapper($db,'users');
$user->set('user_id','admin');
$user->set('password','secret');
$user->save();
$auth=new \Auth($user,
$auth=new \F3\Auth($user,
array('id'=>'user_id','pw'=>'password'));
$test->expect(
$auth->login('admin','secret') &&
Expand All @@ -48,19 +48,19 @@ function get($f3) {
}
}
if (extension_loaded('pdo_sqlite')) {
$db=new \DB\SQL('sqlite::memory:');
$db=new \F3\DB\SQL('sqlite::memory:');
$db->exec(
'CREATE TABLE users ('.
'user_id VARCHAR(30),'.
'password VARCHAR(30),'.
'PRIMARY KEY(user_id)'.
');'
);
$user=new \DB\SQL\Mapper($db,'users');
$user=new \F3\DB\SQL\Mapper($db,'users');
$user->set('user_id','admin');
$user->set('password','secret');
$user->save();
$auth=new \Auth($user,
$auth=new \F3\Auth($user,
array('id'=>'user_id','pw'=>'password'));
$test->expect(
$auth->login('admin','secret') &&
Expand Down
4 changes: 2 additions & 2 deletions app/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class Autoload extends Controller {

function get($f3) {
$test=new \Test;
$test=new \F3\Test;
$test->expect(
is_null($f3->get('ERROR')),
'No errors expected at this point'
Expand Down Expand Up @@ -43,7 +43,7 @@ class_exists('NS\NS6\NS7\C'),
'NS\NS6\NS7\C: ns/ns6/ns7/c.php'
);
$test->expect(
class_exists('\Cache'),
class_exists('\F3\Cache'),
'Class in root namespace: lib/base.php'
);
$f3->set('results',$test->results());
Expand Down
4 changes: 2 additions & 2 deletions app/basket.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
class Basket extends Controller {

function get($f3) {
$test=new \Test;
$test=new \F3\Test;
$test->expect(
is_null($f3->get('ERROR')),
'No errors expected at this point'
);
$basket=new \Basket;
$basket=new \F3\Basket;
$test->expect(
is_object($basket),
'Cursor instantiated'
Expand Down
8 changes: 4 additions & 4 deletions app/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class Cache extends Controller {

function get($f3) {
$test=new \Test;
$test=new \F3\Test;
$test->expect(
is_null($f3->get('ERROR')),
'No errors expected at this point'
Expand All @@ -26,9 +26,9 @@ function get($f3) {
);
$repeat=TRUE;
while ($repeat) {
$cache=\Cache::instance();
$cache=\F3\Cache::instance();
$test->expect(
$cache===\Cache::instance(),
$cache===\F3\Cache::instance(),
'Same cache engine instance returned'
);
$cache->set($f3->hash('foo').'.var','bar',0.05);
Expand Down Expand Up @@ -154,7 +154,7 @@ function($f3) {
sprintf('%.1f',(microtime(TRUE)-$mark)*1e3).'ms'
);
$cache->clear($hash);
$session=new \Session;
$session=new \F3\Session;
$test->expect(
$session->sid()===NULL,
'Cache-based session instantiated but not started'
Expand Down
2 changes: 1 addition & 1 deletion app/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class Config extends Controller {

function get($f3) {
$test=new \Test;
$test=new \F3\Test;
$test->expect(
is_null($f3->get('ERROR')),
'No errors expected at this point'
Expand Down
2 changes: 1 addition & 1 deletion app/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function beforeroute($f3) {
}

function afterroute() {
echo \Preview::instance()->render('layout.htm');
echo \F3\Preview::instance()->render('layout.htm');
}

}
Expand Down
4 changes: 2 additions & 2 deletions app/geo.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
class Geo extends Controller {

function get($f3) {
$test=new \Test;
$test=new \F3\Test;
$test->expect(
is_null($f3->get('ERROR')),
'No errors expected at this point'
);
$geo=new \Web\Geo;
$geo=new \F3\Web\Geo;
$test->expect(
($info=$geo->tzinfo($tz=$f3->get('TZ'))) &&
isset($info['offset']) && isset($info['country']) &&
Expand Down
2 changes: 1 addition & 1 deletion app/globals.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class Globals extends Controller {

function get($f3) {
$test=new \Test;
$test=new \F3\Test;
$test->expect(
is_null($f3->get('ERROR')),
'No errors expected at this point'
Expand Down
6 changes: 3 additions & 3 deletions app/google.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
class Google extends Controller {

function get($f3) {
$test=new \Test;
$test=new \F3\Test;
$test->expect(
is_null($f3->get('ERROR')),
'No errors expected at this point'
);
$f3=\Base::instance();
$map=new \Web\Google\StaticMap;
$f3=\F3\Base::instance();
$map=new \F3\Web\Google\StaticMap;
$test->expect(
$img=$f3->base64(
$map->center('Brooklyn Bridge, New York, NY')->zoom(13)->
Expand Down
2 changes: 1 addition & 1 deletion app/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App;

class Helper extends \Prefab {
class Helper extends \F3\Prefab {

function pick($val,$match) {
return preg_grep('/'.$match.'/',$val);
Expand Down
2 changes: 1 addition & 1 deletion app/hive.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class Hive extends Controller {

function get($f3) {
$test=new \Test;
$test=new \F3\Test;
$test->expect(
is_null($f3->get('ERROR')),
'No errors expected at this point'
Expand Down
14 changes: 7 additions & 7 deletions app/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class Image extends Controller {

function get($f3) {
$test=new \Test;
$test=new \F3\Test;
$test->expect(
is_null($f3->get('ERROR')),
'No errors expected at this point'
Expand All @@ -15,7 +15,7 @@ function get($f3) {
'GD2 extension loaded'
);
if ($loaded) {
$img=new \Image;
$img=new \F3\Image;
$test->expect(
$src=$f3->base64(
$img->captcha('fonts/thunder.ttf')->
Expand Down Expand Up @@ -44,9 +44,9 @@ function get($f3) {
'<img src="'.$src.'" title="Identicon" />'
);
$f3->set('file','images/south-park.jpg');
$img=new \Image($f3->get('file'),TRUE);
$img=new \F3\Image($f3->get('file'),TRUE);
$test->expect(
$orig=\View::instance()->render('image.htm'),
$orig=\F3\View::instance()->render('image.htm'),
'Original image rendered from template<br />'.$orig
);
$test->expect(
Expand Down Expand Up @@ -166,17 +166,17 @@ function get($f3) {
'<img src="'.$src.'" '.
'title="'.$img->width().'x'.$img->height().'" />'
);
$ovr=new \Image('images/watermark.png');
$ovr=new \F3\Image('images/watermark.png');
$ovr->resize(100,38)->rotate(90);
$test->expect(
$src=$f3->base64($img->restore()->
overlay($ovr,\Image::POS_Right|\Image::POS_Middle)->
overlay($ovr,\F3\Image::POS_Right|\F3\Image::POS_Middle)->
dump(),'image/png'),
'Overlay<br />'.
'<img src="'.$src.'" '.
'title="'.$img->width().'x'.$img->height().'" />'
);
$ovr=new \Image('images/watermark.png');
$ovr=new \F3\Image('images/watermark.png');
$ovr->resize(100,38)->rotate(45);
$test->expect(
$src=$f3->base64($img->restore()->
Expand Down
12 changes: 6 additions & 6 deletions app/internals.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class Internals extends Controller {

function get($f3) {
$test=new \Test;
$test=new \F3\Test;
$test->expect(
is_null($f3->get('ERROR')),
'No errors expected at this point'
Expand All @@ -24,7 +24,7 @@ function get($f3) {
);
$f3->foo='bar';
$test->expect(
$f3===\Base::instance() && @\Base::instance()->foo=='bar',
$f3===\F3\Base::instance() && @\F3\Base::instance()->foo=='bar',
'Same framework instance returned'
);
$test->expect(
Expand Down Expand Up @@ -125,17 +125,17 @@ function get($f3) {
$f3->decode($out)=='I\'ll "walk" the <b>dog</b> now™',
'Decode HTML entities'
);
$obj=\Matrix::instance();
$obj=\F3\Matrix::instance();
$test->expect(
\Registry::exists($class=get_class($obj)),
\F3\Registry::exists($class=get_class($obj)),
'instance() saves object to framework registry'
);
$test->expect(
$f3->constants($f3,'REQ_')==array('SYNC'=>\Base::REQ_SYNC,'AJAX'=>\Base::REQ_AJAX),
$f3->constants($f3,'REQ_')==array('SYNC'=>\F3\Base::REQ_SYNC,'AJAX'=>\F3\Base::REQ_AJAX),
'Fetch constants from a class (object)'
);
$test->expect(
$f3->constants('ISO','CC_')==\ISO::instance()->countries(),
$f3->constants('\F3\ISO','CC_')==\F3\ISO::instance()->countries(),
'Fetch constants from a class (string)'
);
$f3->set('results',$test->results());
Expand Down
10 changes: 5 additions & 5 deletions app/jig.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
class Jig extends Controller {

function get($f3) {
$test=new \Test;
$test=new \F3\Test;
$test->expect(
is_null($f3->get('ERROR')),
'No errors expected at this point'
);
$db=new \DB\Jig;
$db=new \F3\DB\Jig;
$db->drop();
$test->expect(
is_object($db),
Expand All @@ -20,7 +20,7 @@ function get($f3) {
$uuid=$db->uuid(),
'UUID: '.$uuid
);
$movie=new \DB\Jig\Mapper($db,'movies');
$movie=new \F3\DB\Jig\Mapper($db,'movies');
$test->expect(
$type=$movie->dbtype(),
'DB type: '.$type
Expand Down Expand Up @@ -221,7 +221,7 @@ function get($f3) {
$obj=$movie->findone(array('@title=?','Zodiac'));
$class=get_class($obj);
$test->expect(
$class=='DB\Jig\Mapper' &&
$class=='F3\DB\Jig\Mapper' &&
$obj->get('title')=='Zodiac' &&
$obj->get('director')=='David Fincher' &&
$obj->get('year')==2007,
Expand All @@ -233,7 +233,7 @@ function get($f3) {
$obj['year']==2007,
'Associative array access'
);
$session=new \DB\Jig\Session($db);
$session=new \F3\DB\Jig\Session($db);
$test->expect(
$session->sid()===NULL,
'Database-managed session instantiated but not started'
Expand Down
4 changes: 2 additions & 2 deletions app/lexicon.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class Lexicon extends Controller {

function get($f3) {
$test=new \Test;
$test=new \F3\Test;
$test->expect(
is_null($f3->get('ERROR')),
'No errors expected at this point'
Expand All @@ -19,7 +19,7 @@ function get($f3) {
$language=$f3->get('LANGUAGE'),
'LANGUAGE: '.$language.' auto-detected'
);
$template=\Template::instance();
$template=\F3\Template::instance();
$f3->set('LANGUAGE','fr-FR');
$test->expect(
substr_count($f3->decode($template->render('templates/lexicon.htm')),
Expand Down
4 changes: 2 additions & 2 deletions app/log.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
class Log extends Controller {

function get($f3) {
$test=new \Test;
$test=new \F3\Test;
$test->expect(
is_null($f3->get('ERROR')),
'No errors expected at this point'
);
$f3->set('LOGS',$tmp=$f3->get('TEMP'));
$log=new \Log($name='test.log');
$log=new \F3\Log($name='test.log');
if (is_file($file=$tmp.$name))
$log->erase();
$log->write('foo');
Expand Down
Loading