public function testFindAll() { $this->_watcher = $this->_createWatcher(); $this->_watcherMapper->insert($this->_watcher); $streamer = $this->_watcherMapper->findAll(); $this->assertInstanceOf('\\Application\\Model\\Stream\\StreamResultModel', $streamer); $this->assertGreaterThanOrEqual(1, $streamer->getCount()); $i = 0; foreach ($streamer as $watcher) { $i++; $this->assertInstanceOf('\\Core\\Model\\WatcherModel', $watcher, "Watcher no. " . $i); $this->assertNotEmpty($watcher->exportData(), "Watcher content no. " . $i); } }
/** * User dependencies injection */ public static function initUserAccount() { $ident = \Zend_Auth::getInstance()->getIdentity(); // Transaction injection \App::get("trackingtoken"); ProtoAbstractMapper::$accountingTransactionPrefix = 'Testing-'; // User injection ProtoAbstractMapper::$accountingUserId = $ident['id']; ProtoAbstractMapper::$language = 'en'; $user = \App::getUserLogged(null, true); $allowed = Zend_Controller_Action_HelperBroker::getStaticHelper('allowed'); $allowed->setUser($user); AbstractMapper::$organizationId = $user->organizationId; // Org injection if (!empty($ident['orgId'])) { $org = OrgService::getInstance()->load($ident['orgId']); if (!$org) { $org = OrgModelFactory::factory(array('id' => $ident['orgId'], 'type' => OrganizationMapper::getTypeByOrgId($ident['orgId']))); } \App::getOrgUserLogged($org); AbstractMapper::$organizationId = $ident['orgId']; } WatcherMapper::getInstance()->destroySingleton(); }
public function setUp() { self::initAuthUser(self::SUPER_USER_ID); $this->_service = WatcherService::getInstance(); $mapper = WatcherMapper::getInstance(); }