本文整理汇总了PHP中eve函数的典型用法代码示例。如果您正苦于以下问题:PHP eve函数的具体用法?PHP eve怎么用?PHP eve使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eve函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testProcess
public function testProcess()
{
$now = explode(" ", microtime());
$model = eve()->model('auth')->create()->process(array('auth_slug' => 'TEST AUTH ' + $now[1], 'auth_permissions' => 'test_permissions_1,test_permissions_2', 'auth_password' => '123456', 'confirm' => '123456'));
$this->assertTrue(is_numeric($model['auth_id']));
eve()->registry()->set('test', 'auth', $model->get());
}
示例2: run
/**
* Executes the job
*
* @return void
*/
public function run()
{
//if no data
if (empty($this->data)) {
//there should be a global catch somewhere
throw new Exception(self::FAIL_406);
}
//this will be returned at the end
$results = array();
//see if the email exists first
$exists = eve()->model('auth')->exists($this->data['profile_email']);
//if it does
if ($exists) {
//not sure, throw an error ?
throw new Exception('Email exists.');
}
//find the profile by email
$row = eve()->model('profile')->search()->process()->filterByProfileEmail($this->data['profile_email'])->getRow();
//if no profile
if (empty($row)) {
//create one
$row = eve()->model('profile')->create()->process($this->data)->get();
}
//store the profile
$results['profile'] = $row;
//create the auth
$results['auth'] = eve()->model('auth')->create()->process($this->data)->get();
//link profile
eve()->model('auth')->linkProfile($results['auth']['auth_id'], $results['profile']['profile_id']);
return $results;
}
示例3: import
/**
* Main route method
*
* @return function
*/
public function import(array $l10n = array())
{
//remember this scope
$self = $this;
//You can add validators here
return function ($request, $response) use($self, $l10n) {
//before we do anything, lets's check for l10n and i18n
$host = $request->get('server', 'HTTP_HOST');
//if we can't find the host
if (!isset($l10n[$host]) || $l10n[$host] === 'default') {
//just use the default settings
$host = 'default';
}
//if it's a redirect
if (is_string($l10n[$host])) {
eve()->redirect('http://' . $l10n[$host]);
}
//load the languages
foreach ($l10n[$host]['i18n'] as $i => $i18n) {
$translations = eve()->settings('i18n/' . $i18n);
if ($i === 0) {
eve()->defaultLanguage = eve('language', $translations);
}
$request->set('i18n', $i18n, $translations);
}
//set the locale
$request->set('l10n', $l10n[$host]);
};
}
示例4: testRender
public function testRender()
{
$app = eve()->registry()->get('test', 'app');
$_GET = array('client_id' => $app['app_token'], 'redirect_uri' => '/control/app/search');
$results = BrowserTest::i()->setPath('/dialog/action/login')->setGet($_GET)->setQueryString($_GET)->setIsTriggered(true)->process();
$this->assertTrue($results['triggered']);
}
示例5: testUnlinkProfile
public function testUnlinkProfile()
{
$auth = eve()->registry()->get('test', 'auth');
$model = eve()->model('auth')->unlinkProfile($auth['auth_id'], 400);
$this->assertEquals($auth['auth_id'], $model['auth_profile_auth']);
$this->assertEquals(400, $model['auth_profile_profile']);
}
示例6: testImport
public function testImport()
{
$callback = Eve\Plugin\Csrf\Setup::i()->import();
$this->assertTrue(is_callable($callback));
$error = false;
try {
eve()->addCsrf(eden('registry'), eden('registry'), array('method' => 'GET', 'check_csrf' => true));
} catch (Exception $e) {
$error = true;
}
$this->assertTrue($error);
$error = false;
$request = eden('registry')->set('get', 'csrf', '1234567890');
try {
eve()->addCsrf($request, eden('registry'), array('method' => 'GET', 'check_csrf' => true, 'make_csrf' => true));
} catch (Exception $e) {
$error = true;
}
$this->assertFalse($error);
$this->assertTrue($request->get('get', 'csrf') !== $request->get('csrf'));
$_GET['csrf'] = $_SESSION['csrf'] = $request->get('csrf');
$error = false;
try {
$callback($request, eden('registry'));
} catch (Exception $e) {
$error = true;
}
$this->assertFalse($error);
}
示例7: testRender
public function testRender()
{
$app = eve()->registry()->get('test', 'app');
$_GET = array('access_token' => $app['app_token']);
$results = BrowserTest::i()->setPath('/rest/action/profile/search')->setGet($_GET)->setSource($_GET)->setIsTriggered(false)->process();
$this->assertContains('"error": false', $results['data']);
}
示例8: testProcess
public function testProcess()
{
$auth = eve()->registry()->get('test', 'auth');
$profile = eve()->registry()->get('test', 'profile');
$row = eve()->model('session')->login()->process(array('auth_slug' => $auth['auth_slug'], 'auth_password' => '123456'));
$this->assertEquals($profile['profile_name'], $row['profile_name']);
}
示例9: testProcess
public function testProcess()
{
$now = explode(" ", microtime());
$auth = eve()->registry()->get('test', 'auth');
$model = eve()->model('auth')->update()->process(array('auth_id' => $auth['auth_id'], 'auth_slug' => 'TEST AUTH ' + $now[1], 'auth_permissions' => 'test_permissions_1,test_permissions_2', 'auth_password' => '123456', 'confirm' => '123456'));
$this->assertEquals('test_permissions_1,test_permissions_2', $model['auth_permissions']);
}
示例10: testGetAppByToken
public function testGetAppByToken()
{
$session = eve()->registry()->get('test', 'session');
$app = eve()->registry()->get('test', 'app');
$row = eve()->model('session')->getAppByToken($session['access_token']);
$this->assertEquals($app['app_id'], $row['app_id']);
}
示例11: testProcess
public function testProcess()
{
$rows = eve()->model('profile')->search()->process()->getRows();
foreach ($rows as $row) {
$this->assertEquals(1, $row['profile_active']);
}
}
示例12: testValid
public function testValid()
{
$data = array('app_name' => 'Test Action App Updated', 'app_domain' => '*.test.com', 'app_permissions' => 'public_sso,user_profile,global_profile', 'profile_id' => $_SESSION['me']['profile_id']);
$app = eve()->registry()->get('test', 'app');
$variables = array($app['app_id']);
$results = BrowserTest::i()->setPath('/back/action/app/update')->setPost($data)->setVariables($variables)->setIsValid(true)->setIsTriggered(true)->process();
$this->assertTrue($results['triggered']);
}
示例13: testProcess
public function testProcess()
{
$auth = eve()->registry()->get('test', 'auth');
$app = eve()->registry()->get('test', 'app');
$config = eve()->settings('test');
$model = eve()->model('session')->request()->process(array('app_id' => $app['app_id'], 'auth_id' => $auth['auth_id'], 'session_permissions' => implode(',', $config['scope'])));
$this->assertTrue(is_string($model['session_token']));
eve()->registry()->set('test', 'session', $model->get());
}
示例14: testRender
public function testRender()
{
$app = eve()->registry()->get('test', 'app');
$_GET = array('access_token' => $app['app_token'], 'access_secret' => $app['app_secret']);
$_POST = array('profile_name' => 'Profile updated by REST');
$source = array('profile_id' => 1);
$results = BrowserTest::i()->setPath('/rest/action/profile/update')->setPost($_POST)->setSource($source)->setIsTriggered(false)->process();
$this->assertContains('"error": false', $results['data']);
}
示例15: testValid
public function testValid()
{
$app = eve()->registry()->get('test', 'app');
$_GET = array('client_id' => $app['app_token'], 'redirect_uri' => '/control/app/search');
$_POST = array('profile_name' => 'Test Dialog Action Create', 'profile_email' => 'testdialog2@test.com', 'auth_permissions' => 'user_profile,personal_profile,global_profile', 'auth_password' => '123', 'confirm' => '123');
$app = eve()->registry()->get('test', 'app');
$results = BrowserTest::i()->setPath('/dialog/action/update')->setGet($_GET)->setPost($_POST)->setSource($app)->setQueryString($_POST)->setIsValid(true)->setIsTriggered(true)->process();
$this->assertTrue($results['triggered']);
}