Completed
Pull Request — master (#3)
by Kevin
03:52
created

Tweet::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 8
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 5
nc 1
nop 2
1
<?php
2
3
namespace Magium\Twitter\Actions;
4
5
use Magium\Twitter\Themes\Twitter;
6
use Magium\WebDriver\ExpectedCondition;
7
use Magium\WebDriver\WebDriver;
8
9
class Tweet
10
{
11
12
    const ACTION = 'Magium\Twitter\Actions\Tweet';
13
14
    protected $theme;
15
    protected $webDriver;
16
17
    public function __construct(
18
        Twitter $theme,
19
        WebDriver $webDriver
20
    )
21
    {
22
        $this->theme = $theme;
23
        $this->webDriver = $webDriver;
24
    }
25
26
    public function tweet($text)
27
    {
28
29
        $element = $this->webDriver->byXpath($this->theme->getTweetBoxXpath());
30
        $element->click();
31
32
        $this->webDriver->getKeyboard()->sendKeys($text);
33
34
        $element = $this->webDriver->byXpath($this->theme->getTweetButton());
35
        $element->click();
36
37
    }
38
39
}