magium/twitter 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

magium/twitter

Composer 安装命令:

composer require --dev magium/twitter

包简介

Provides a mechanism for logging in to Twitter to validate OAuth-based tests

README 文档

README

Scrutinizer Code Quality

magium/twitter

This is a simple library to help browser tests perform OAuth logins to Twitter.

To install

composer require magium/twitter

To use:

use Magium\Twitter\Actions\AuthenticateTwitter;

class TwitterTest extends \Magium\AbstractTestCase
{

    public function testLogin()
    {
        // Do something that forwards the browser to the twitter OAuth page.

         $action = $this->getAction(AuthenticateTwitter::ACTION);
        /* @var $action AuthenticateTwitter */
        $action->execute();
    }

}

Setting the username and password

There are two ways to set the username and password

In code

use Magium\Twitter\Identities\Twitter
use Magium\Twitter\Actions\AuthenticateTwitter;

class TwitterTest extends \Magium\AbstractTestCase
{

    public function testLogin()
    {

        $identity = $this->getIdentity(Twitter::IDENTITY);
        /* @var $identity Twitter */
        $identity->setUsername('username');
        $identity->setPassword('password');

        // Do something that forwards the browser to the twitter OAuth page.

         $action = $this->getAction(AuthenticateTwitter::ACTION);
        /* @var $action AuthenticateTwitter */
        $action->execute();
    }

}

In configuration

Create the file /configuration/Magium/Twitter/Identities/Twitter.php and enter the following:

<?php

/* @var $this \Magium\Twitter\Identities\Twitter */
$this->username = 'username';
$this->password = 'password';

Note that you should be familiar with AbstractConfigurableElements to do this

##Sign In With Twitter

Using the sign-in-with-Twitter functionality


    public function testSignInWithTwitter()
    {
        
        $action = $this->getAction(SignInWithTwitter::ACTION);
        /* @var $action SignInWithTwitter */
        $action->execute();

    }

##Log In To Twitter

To log in via the Twitter front page...


    public function testAuthenticate()
    {
        $this->getAction(AuthenticateTwitter::ACTION)->execute();
    }

##To tweet


    public function testTweet()
    {
        $text = 'This is text I would like to tweet';

        $this->getAction(AuthenticateTwitter::ACTION)->execute();
        $this->getAction(Tweet::ACTION)->tweet($text);
    }

统计信息

  • 总下载量: 51
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: ASL-2.0
  • 更新时间: 2016-04-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固