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


PHP Store::factory方法代码示例

本文整理汇总了PHP中Store::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP Store::factory方法的具体用法?PHP Store::factory怎么用?PHP Store::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Store的用法示例。


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

示例1: testFactory

 public function testFactory()
 {
     $this->assertInstanceOf('Store_Local', Store::factory());
     $this->assertInstanceOf('Store_Local', Store::factory(Store::Local));
     $this->assertInstanceOf('Store_Session', Store::factory(Store::Session));
     $this->assertEquals(false, Store::factory('Undefined type'));
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:7,代码来源:StoreTest.php

示例2: testAdd

 /**
  * @covers QueueController::Add
  * @todo Implement testAdd().
  */
 public function testAdd()
 {
     $person = Person::factory('adult');
     $person->name = 'Poehavshiy';
     $person->add();
     $store = Store::factory('Grocery');
     $store->name = 'Prison';
     $store->add();
     $product = new Product();
     $product->name = 'Sladkiy hleb';
     $product->add();
     $request = Application::getInstance()->request;
     $request->setParams(array('storeId' => $store->id, 'personId' => $person->id, 'product_' . $product->id => 'on'));
     $personId = $request->p('personId');
     $storeId = $request->p('storeId');
     $store = Store::get($storeId);
     $person = Person::get($personId);
     $store->queue->add($person);
     $person->basket->drop();
     $name = 'product_' . $product->id;
     $value = $product;
     if (preg_match_all('/^product_(\\d+)$/', $name, $matches)) {
         $person->basket->add(Product::get($matches[1][0]));
     }
 }
开发者ID:ruyozora,项目名称:Test-test,代码行数:29,代码来源:QueueControllerTest.php

示例3: testSetData

 public function testSetData()
 {
     $store = Store::factory(Store::Local, 'test');
     $store->set('key', 'val');
     $data = array('key2' => 'val2', 'key3' => 'val3');
     $store->setData($data);
     $this->assertEquals($data, $store->getData());
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:8,代码来源:LocalTest.php

示例4: Add

 public function Add()
 {
     $this->_response()->asJSON();
     try {
         $name = $this->_request()->p('name');
         $type = $this->_request()->p('type');
         $store = Store::factory($type);
         $store->name = trim($name);
         $store->add();
         return array('id' => $store->id, 'name' => $store->name, 'type' => $store->type, 'expl' => $store::explainType());
     } catch (Exception $e) {
         return array('error' => $e->getMessage());
     }
 }
开发者ID:ruyozora,项目名称:Test-test,代码行数:14,代码来源:StoreController.php

示例5: __construct

 public function __construct()
 {
     $this->_session = Store::factory(Store::Session, 'install');
     $this->_docRoot = DVELUM_ROOT . '/';
     $this->_wwwRoot = '/';
     $docRoot = $_SERVER['DOCUMENT_ROOT'];
     if ($docRoot[strlen($docRoot) - 1] === '/') {
         $docRoot = substr($docRoot, 0, -1);
     }
     $uri = $_SERVER['REQUEST_URI'];
     $parts = explode('/', $uri);
     for ($i = 1; $i < sizeof($parts); $i++) {
         if ($parts[$i] === 'install') {
             break;
         }
         $this->_wwwRoot .= $parts[$i] . '/';
     }
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:18,代码来源:Controller.php

示例6: testAdd

 /**
  * @covers Assortment::add
  * @todo Implement testAdd().
  */
 public function testAdd()
 {
     $db = Application::getInstance()->mysqli;
     $db->query('DELETE FROM Product');
     $db->query('DELETE FROM Store');
     $db->query('DELETE FROM Assortment');
     for ($i = 1; $i < 3; $i++) {
         $store = Store::factory('grocery');
         $store->name = 'store_' . $i;
         $store->add();
         $stores[] = $store;
     }
     for ($i = 1; $i < 10; $i++) {
         $product = new Product();
         $product->name = 'product_' . $i;
         $product->add();
         $products[] = $product;
         $map[$product->id] = rand(0, 2);
     }
     $a = $stores[1]->assortment;
     $a->map($map);
 }
开发者ID:ruyozora,项目名称:Test-test,代码行数:26,代码来源:AssortmentTest.php

示例7: _connectStore

 /**
  * Instantiate storage
  * @return Store
  */
 protected static function _connectStore()
 {
     self::$_store = Store::factory(Store::Local, 'class_' . __CLASS__);
     return self::$_store;
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:9,代码来源:Config.php

示例8: getStorage

 /**
  * Get link to local data storage (store runtime data)
  * @return Store_Local
  * @deprecated
  */
 public static function getStorage()
 {
     return Store::factory(Store::Local);
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:9,代码来源:Application.php

示例9: __construct

 public function __construct()
 {
     if (!self::$_storage) {
         self::$_storage = Store::factory(Store::Session, 'security_csrf');
     }
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:6,代码来源:Csrf.php

示例10: logout

 /**
  *  Remove User authorization data (the session remains active, while the User is logged out)
  */
 public function logout()
 {
     $ses = Store::factory(Store::Session);
     $ses->set('auth', false);
     $ses->set('auth_id', false);
     $this->_authChecked = false;
     $this->_info = array();
     $this->_permissions = null;
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:12,代码来源:User.php


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