当前位置: 首页>>代码示例>>PHP>>正文


PHP RedBeanPHP\Facade类代码示例

本文整理汇总了PHP中RedBeanPHP\Facade的典型用法代码示例。如果您正苦于以下问题:PHP Facade类的具体用法?PHP Facade怎么用?PHP Facade使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Facade类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getResults

 /**
  * @return array
  */
 public function getResults()
 {
     if ($this->storedNumber > $this->maxResults) {
         $startFrom = $this->maxResults * $this->startPage;
         $extraSQL = 'ORDER BY id ASC LIMIT ' . $startFrom . ',' . $this->maxResults;
         return Facade::findAll($this->DBTable, $extraSQL);
     } else {
         return Facade::findAll($this->DBTable);
     }
 }
开发者ID:AsemKhatib,项目名称:MyPoll-OOP-PHP-Poll-system,代码行数:13,代码来源:pagenation.class.php

示例2: testDatabaseInstallation

 public function testDatabaseInstallation()
 {
     $this->url('index.php');
     //All Fields initially with empty
     $this->fillFields(array('hostname' => 'localhost', 'username' => 'root', 'password' => '', 'database' => 'phpback_test', 'adminemail' => 'admin@phpback.org', 'adminname' => 'admin', 'adminpass' => 'admin', 'adminrpass' => 'admin'));
     //Submit form
     $this->byName('install-form')->submit();
     //Should delete first intallation files
     $this->assertFileNotExists('install/index.php');
     $this->assertFileNotExists('install/install1.php');
     $this->assertFileNotExists('install/database_tables.sql');
     //Should create configuration file
     $this->assertFileExists('application/config/database.php');
     include 'application/config/database.php';
     $this->assertEquals($db['default']['username'], 'root');
     $this->assertEquals($db['default']['password'], '');
     $this->assertEquals($db['default']['database'], 'phpback_test');
     $this->assertEquals($db['default']['username'], 'root');
     $this->assertEquals($db['default']['dbdriver'], 'mysqli');
     //Should have updated database with new tables
     $this->assertEquals(RedBean::inspect(), array('_sessions', 'categories', 'comments', 'flags', 'ideas', 'logs', 'settings', 'users', 'votes'));
     //Should have created the admin user
     $adminUser = RedBean::load('users', 1);
     $this->assertEquals($adminUser->name, 'admin');
     $this->assertEquals($adminUser->email, 'admin@phpback.org');
     $this->assertEquals($adminUser->isadmin, '3');
     $this->assertEquals($adminUser->votes, '20');
 }
开发者ID:AntonyAntonio,项目名称:phpback,代码行数:28,代码来源:InstallTest.php

示例3: testGetInsertID

 /**
  * Tests R::getInsertID convenience method.
  *
  * @return void
  */
 public function testGetInsertID()
 {
     R::nuke();
     $id = R::store(R::dispense('book'));
     $id2 = R::getInsertID();
     asrt($id, $id2);
 }
开发者ID:AntonyAntonio,项目名称:phpback,代码行数:12,代码来源:Setget.php

示例4: testRebuilder

 /**
  * Test SQLite table rebuilding.
  *
  * @return void
  */
 public function testRebuilder()
 {
     $toolbox = R::getToolBox();
     $adapter = $toolbox->getDatabaseAdapter();
     $writer = $toolbox->getWriter();
     $redbean = $toolbox->getRedBean();
     $pdo = $adapter->getDatabase();
     $book = R::dispense('book');
     $page = R::dispense('page');
     $book->xownPage[] = $page;
     $id = R::store($book);
     $book = R::load('book', $id);
     asrt(count($book->xownPage), 1);
     asrt((int) R::getCell('SELECT COUNT(*) FROM page'), 1);
     R::trash($book);
     asrt((int) R::getCell('SELECT COUNT(*) FROM page'), 0);
     $book = R::dispense('book');
     $page = R::dispense('page');
     $book->xownPage[] = $page;
     $id = R::store($book);
     $book = R::load('book', $id);
     asrt(count($book->xownPage), 1);
     asrt((int) R::getCell('SELECT COUNT(*) FROM page'), 1);
     $book->added = 2;
     R::store($book);
     $book->added = 'added';
     R::store($book);
     R::trash($book);
     asrt((int) R::getCell('SELECT COUNT(*) FROM page'), 0);
 }
开发者ID:gabordemooij,项目名称:redbean,代码行数:35,代码来源:Rebuild.php

示例5: testPlaysNiceWithPreExitsingSchema

 /**
  * Test integration with pre-existing schemas.
  *
  * @return void
  */
 public function testPlaysNiceWithPreExitsingSchema()
 {
     $toolbox = R::getToolBox();
     $adapter = $toolbox->getDatabaseAdapter();
     $writer = $toolbox->getWriter();
     $redbean = $toolbox->getRedBean();
     $pdo = $adapter->getDatabase();
     $a = new AssociationManager($toolbox);
     $page = $redbean->dispense("page");
     $page->name = "John's page";
     $idpage = $redbean->store($page);
     $page2 = $redbean->dispense("page");
     $page2->name = "John's second page";
     $idpage2 = $redbean->store($page2);
     $a->associate($page, $page2);
     $adapter->exec("ALTER TABLE " . $writer->esc('page') . "\n\t\tCHANGE " . $writer->esc('name') . " " . $writer->esc('name') . "\n\t\tVARCHAR( 254 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL ");
     $page = $redbean->dispense("page");
     $page->name = "Just Another Page In a Table";
     $cols = $writer->getColumns("page");
     asrt($cols["name"], "varchar(254)");
     //$pdo->SethMode(1);
     $redbean->store($page);
     pass();
     // No crash?
     $cols = $writer->getColumns("page");
     asrt($cols["name"], "varchar(254)");
     //must still be same
 }
开发者ID:diego-vieira,项目名称:redbean,代码行数:33,代码来源:Preexist.php

示例6: testDoesToolboxContainTheTools

 /**
  * Does the toolbox contain the necessary tools ?
  * 
  * @return void
  */
 public function testDoesToolboxContainTheTools()
 {
     $toolbox = R::getToolBox();
     asrt($toolbox->getDatabaseAdapter() instanceof Adapter, TRUE);
     asrt($toolbox->getRedBean() instanceof OODB, TRUE);
     asrt($toolbox->getWriter() instanceof QueryWriter, TRUE);
 }
开发者ID:skullyframework,项目名称:skully,代码行数:12,代码来源:Toolbox.php

示例7: testTainted

 /**
  * Test tainted.
  *
  * @return void
  */
 public function testTainted()
 {
     testpack('Original Tainted Tests');
     $redbean = R::getRedBean();
     $spoon = $redbean->dispense("spoon");
     asrt($spoon->getMeta("tainted"), TRUE);
     $spoon->dirty = "yes";
     asrt($spoon->getMeta("tainted"), TRUE);
     testpack('Tainted List test');
     $note = R::dispense('note');
     $note->text = 'abc';
     $note->ownNote[] = R::dispense('note')->setAttr('text', 'def');
     $id = R::store($note);
     $note = R::load('note', $id);
     asrt($note->isTainted(), FALSE);
     // Shouldn't affect tainted
     $note->text;
     asrt($note->isTainted(), FALSE);
     $note->ownNote;
     asrt($note->isTainted(), TRUE);
     testpack('Tainted Test Old Value');
     $text = $note->old('text');
     asrt($text, 'abc');
     asrt($note->hasChanged('text'), FALSE);
     $note->text = 'xxx';
     asrt($note->hasChanged('text'), TRUE);
     $text = $note->old('text');
     asrt($text, 'abc');
     testpack('Tainted Non-exist');
     asrt($note->hasChanged('text2'), FALSE);
     testpack('Misc Tainted Tests');
     $bean = R::dispense('bean');
     $bean->hasChanged('prop');
     $bean->old('prop');
 }
开发者ID:cesium147,项目名称:redbean,代码行数:40,代码来源:Tainted.php

示例8: logout

 public function logout()
 {
     $adminId = $this->app->getSession()->get('adminId');
     $sql = "delete from `adminsession` where `admin_id` = '" . $adminId . "'";
     R::exec($sql);
     $this->app->getSession()->remove('adminId');
 }
开发者ID:skullyframework,项目名称:skully-admin,代码行数:7,代码来源:AdminRepository.php

示例9: testInnoDBIndexLimit

 /**
  * Test varchar 191 condition.
  *
  * @return void
  */
 public function testInnoDBIndexLimit()
 {
     R::nuke();
     $book = R::dispense('book');
     $book->text = 'abcd';
     R::store($book);
     $columns = R::inspect('book');
     asrt(isset($columns['text']), TRUE);
     asrt($columns['text'], 'varchar(191)');
     $book = $book->fresh();
     $book->text = str_repeat('x', 190);
     R::store($book);
     $columns = R::inspect('book');
     asrt(isset($columns['text']), TRUE);
     asrt($columns['text'], 'varchar(191)');
     $book = $book->fresh();
     $book->text = str_repeat('x', 191);
     R::store($book);
     $columns = R::inspect('book');
     asrt(isset($columns['text']), TRUE);
     asrt($columns['text'], 'varchar(191)');
     $book = $book->fresh();
     $book->text = str_repeat('x', 192);
     R::store($book);
     $columns = R::inspect('book');
     asrt(isset($columns['text']), TRUE);
     asrt($columns['text'], 'varchar(255)');
 }
开发者ID:AntonyAntonio,项目名称:phpback,代码行数:33,代码来源:Issue411.php

示例10: uploadImage

 public function uploadImage()
 {
     $error = '';
     $uploadedImages = array();
     if (isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST") {
         // Find instance
         $id = $this->getParam($this->instanceName . '_id');
         if (!empty($id)) {
             /** @var \RedbeanPHP\SimpleModel $instanceBean */
             $instanceBean = R::findOne($this->model(), 'id = ?', array($id));
             /** @var \Skully\App\Models\Setting $instance */
             $instance = $instanceBean->box();
         } else {
             $instance = null;
         }
         try {
             $uploadedImages = $this->processUploadedImage($instance, $this->getParam('settingName'));
         } catch (\Exception $e) {
             $error = $e->getMessage();
         }
     }
     if (!empty($error)) {
         echo json_encode(array('error' => $error));
     } else {
         echo json_encode($uploadedImages);
     }
 }
开发者ID:skullyframework,项目名称:skully-admin,代码行数:27,代码来源:ImageUploaderCRUD.php

示例11: testDump

 /**
  * Test dump().
  *
  * @return void
  */
 public function testDump()
 {
     $beans = R::dispense('bean', 2);
     $beans[0]->name = 'hello';
     $beans[1]->name = 'world';
     $array = R::dump($beans);
     asrt(is_array($array), TRUE);
     foreach ($array as $item) {
         asrt(is_string($item), TRUE);
     }
     $beans[1]->name = 'world, and a very long string that should be shortened';
     $array = R::dump($beans);
     asrt(is_array($array), TRUE);
     asrt(strpos($array[1], '...'), 35);
     //just to get 100% test cov, we dont need to test this
     dmp($beans);
     pass();
     //test wrong input
     asrt(is_array(R::dump(NULL)), TRUE);
     asrt(count(R::dump(NULL)), 0);
     asrt(is_array(R::dump('')), TRUE);
     asrt(count(R::dump('')), 0);
     asrt(is_array(R::dump(1)), TRUE);
     asrt(count(R::dump(1)), 0);
     asrt(is_array(R::dump(TRUE)), TRUE);
     asrt(count(R::dump(FALSE)), 0);
 }
开发者ID:cesium147,项目名称:redbean,代码行数:32,代码来源:Debug.php

示例12: testDisableVoteIdea

 public function testDisableVoteIdea()
 {
     Scripts::LoginUser('newemail2@phpback.org', 'Gates123');
     $this->url('home/profile/4');
     $this->byLinkText('Delete votes')->click();
     $voteidea = RedBean::load('ideas', 3);
     $this->assertEquals($voteidea->votes, '0');
 }
开发者ID:AntonyAntonio,项目名称:phpback,代码行数:8,代码来源:UserTest.php

示例13: testBasicBox

 /**
  * Test boxing.
  *
  * @return void
  */
 public function testBasicBox()
 {
     $soup = R::dispense('soup');
     $soup->flavour = 'tomato';
     $this->giveMeSoup($soup->box());
     $this->giveMeBean($soup->box()->unbox());
     $this->giveMeBean($soup);
 }
开发者ID:diego-vieira,项目名称:redbean,代码行数:13,代码来源:Fusebox.php

示例14: testTwoWordsUnderscoredBean

 /**
  * Cant have underscored beans
  * @expectedException \RedBeanPHP\RedException
  */
 public function testTwoWordsUnderscoredBean()
 {
     R::freeze(false);
     $testName = R::dispense('test_name');
     $id = R::store($testName);
     R::load('test_name', $id);
     R::freeze($this->frozen);
 }
开发者ID:skullyframework,项目名称:project,代码行数:12,代码来源:ModelTest.php

示例15: testCreateAdmin

 public function testCreateAdmin()
 {
     $this->migrate();
     $admin = $this->app->createModel('admin', array('name' => 'Admin', 'email' => 'admin@skullyframework.com', 'password' => 'lepass', 'password_confirmation' => 'lepass', 'status' => Admin::STATUS_ACTIVE));
     R::store($admin);
     $bean = R::findOne('admin', 'name = ?', array('Admin'));
     $this->assertEquals($bean->name, $admin->get('name'));
 }
开发者ID:skullyframework,项目名称:skully-admin,代码行数:8,代码来源:TestAdminCreation.php


注:本文中的RedBeanPHP\Facade类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。