本文整理汇总了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'));
}
示例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]));
}
}
示例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());
}
示例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());
}
}
示例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] . '/';
}
}
示例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);
}
示例7: _connectStore
/**
* Instantiate storage
* @return Store
*/
protected static function _connectStore()
{
self::$_store = Store::factory(Store::Local, 'class_' . __CLASS__);
return self::$_store;
}
示例8: getStorage
/**
* Get link to local data storage (store runtime data)
* @return Store_Local
* @deprecated
*/
public static function getStorage()
{
return Store::factory(Store::Local);
}
示例9: __construct
public function __construct()
{
if (!self::$_storage) {
self::$_storage = Store::factory(Store::Session, 'security_csrf');
}
}
示例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;
}