ElggSession::getMock PHP Метод

getMock() публичный статический Метод

Get an isolated ElggSession that does not persist between requests
public static getMock ( ) : self
Результат self
    public static function getMock()
    {
        $storage = new MockArraySessionStorage();
        $session = new Session($storage);
        return new self($session);
    }

Usage Example

Пример #1
0
 /**
  * Constructor
  */
 public function __construct()
 {
     $sp = _elgg_services();
     $this->setValue('session', \ElggSession::getMock());
     $this->setFactory('db', function (MockServiceProvider $m) use($sp) {
         $config = $this->getTestingDatabaseConfig();
         return new \Elgg\Mocks\Database($config, $sp->logger);
     });
     $this->setFactory('entityTable', function (MockServiceProvider $m) use($sp) {
         return new \Elgg\Mocks\Database\EntityTable($sp->config, $m->db, $sp->entityCache, $sp->metadataCache, $m->subtypeTable, $sp->events, $sp->session, $sp->translator, $sp->logger);
     });
     $this->setFactory('metadataTable', function (MockServiceProvider $m) use($sp) {
         return new \Elgg\Mocks\Database\MetadataTable($sp->metadataCache, $m->db, $m->entityTable, $sp->events, $m->session);
     });
     $this->setFactory('annotations', function (MockServiceProvider $m) use($sp) {
         return new \Elgg\Mocks\Database\Annotations($m->db, $m->session, $sp->events);
     });
     $this->setFactory('relationshipsTable', function (MockServiceProvider $m) use($sp) {
         return new \Elgg\Mocks\Database\RelationshipsTable($m->db, $m->entityTable, $m->metadataTable, $sp->events);
     });
     $this->setFactory('subtypeTable', function (MockServiceProvider $m) {
         return new \Elgg\Mocks\Database\SubtypeTable($m->db);
     });
     $this->setFactory('accessCollections', function (MockServiceProvider $m) use($sp) {
         return new \Elgg\Mocks\Database\AccessCollections($sp->config, $m->db, $m->entityTable, $sp->accessCache, $sp->hooks, $sp->session, $sp->translator);
     });
     $this->setFactory('privateSettings', function (MockServiceProvider $m) use($sp) {
         return new \Elgg\Mocks\Database\PrivateSettingsTable($m->db, $m->entityTable, $sp->pluginSettingsCache);
     });
 }
All Usage Examples Of ElggSession::getMock