|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* ownCloud |
|
4
|
|
|
* |
|
5
|
|
|
* @author Phillip Davis |
|
6
|
|
|
* @copyright 2017 Phillip Davis [email protected] |
|
7
|
|
|
* |
|
8
|
|
|
* This library is free software; you can redistribute it and/or |
|
9
|
|
|
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE |
|
10
|
|
|
* License as published by the Free Software Foundation; either |
|
11
|
|
|
* version 3 of the License, or any later version. |
|
12
|
|
|
* |
|
13
|
|
|
* This library is distributed in the hope that it will be useful, |
|
14
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16
|
|
|
* GNU AFFERO GENERAL PUBLIC LICENSE for more details. |
|
17
|
|
|
* |
|
18
|
|
|
* You should have received a copy of the GNU Affero General Public |
|
19
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>. |
|
20
|
|
|
* |
|
21
|
|
|
*/ |
|
22
|
|
|
|
|
23
|
|
|
use Behat\Behat\Context\Context; |
|
24
|
|
|
use Behat\Behat\Hook\Scope\BeforeScenarioScope; |
|
25
|
|
|
use Behat\Gherkin\Node\PyStringNode; |
|
26
|
|
|
use Behat\MinkExtension\Context\RawMinkContext; |
|
27
|
|
|
use Page\TextEditorPage; |
|
28
|
|
|
|
|
29
|
|
|
require_once 'bootstrap.php'; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Files context. |
|
33
|
|
|
*/ |
|
34
|
|
|
class TextEditorContext extends RawMinkContext implements Context |
|
35
|
|
|
{ |
|
36
|
|
|
private $textEditorPage; |
|
37
|
|
|
private $featureContext; |
|
38
|
|
|
private $filesContext; |
|
39
|
|
|
|
|
40
|
|
|
public function __construct(TextEditorPage $textEditorPage) |
|
41
|
|
|
{ |
|
42
|
|
|
$this->textEditorPage = $textEditorPage; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @When I create a text file with the name :name |
|
47
|
|
|
* |
|
48
|
|
|
* @param string $name |
|
49
|
|
|
* @return void |
|
50
|
|
|
*/ |
|
51
|
|
|
public function createATextFile($name) { |
|
52
|
|
|
$this->textEditorPage->createTextFile($name); |
|
53
|
|
|
$this->textEditorPage->waitTillEditorIsLoaded(); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @When I input :text in the text area |
|
58
|
|
|
*/ |
|
59
|
|
|
public function iInputTextInTheTextArea($text) |
|
60
|
|
|
{ |
|
61
|
|
|
$this->textEditorPage->typeIntoTextFile($text); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @When I input the following text in the text area: |
|
66
|
|
|
*/ |
|
67
|
|
|
public function iInputTheFollowingInTheTextArea(PyStringNode $multiLineText) |
|
68
|
|
|
{ |
|
69
|
|
|
$this->textEditorPage->typeIntoTextFile($multiLineText->getRaw()); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* general before scenario for all text editor tests. |
|
74
|
|
|
* This will run before EVERY scenario. |
|
75
|
|
|
* It will set the properties for this object. |
|
76
|
|
|
* |
|
77
|
|
|
* @param BeforeScenarioScope $scope |
|
78
|
|
|
* @return void |
|
79
|
|
|
* @BeforeScenario |
|
80
|
|
|
*/ |
|
81
|
|
|
public function before(BeforeScenarioScope $scope) { |
|
82
|
|
|
// Get the environment |
|
83
|
|
|
$environment = $scope->getEnvironment(); |
|
84
|
|
|
// Get all the contexts you need in this context |
|
85
|
|
|
$this->featureContext = $environment->getContext('FeatureContext'); |
|
86
|
|
|
$this->filesContext = $environment->getContext('FilesContext'); |
|
87
|
|
|
$this->tmpDir = $this->getMinkParameter("show_tmp_dir"); |
|
88
|
|
|
$suiteParameters = $scope->getEnvironment()->getSuite() |
|
89
|
|
|
->getSettings() ['context'] ['parameters']; |
|
90
|
|
|
$this->ocPath = $suiteParameters['ocPath']; |
|
91
|
|
|
} |
|
92
|
|
|
} |
|
93
|
|
|
|