This repository was archived by the owner on Dec 14, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +97
-5
lines changed Expand file tree Collapse file tree 5 files changed +97
-5
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
- namespace AlexisLefebvre \Bundle \AsyncTweetsBundle \Tests \Features \bootstrap ;
3
+ namespace AlexisLefebvre \Bundle \AsyncTweetsBundle \Tests \Features \Context ;
4
4
5
5
use AlexisLefebvre \Bundle \AsyncTweetsBundle \Entity \Tweet ;
6
- use Behat \Behat \Context \SnippetAcceptingContext ;
6
+ use Behat \Behat \Context \Context ;
7
7
8
- class FeatureContext implements SnippetAcceptingContext
8
+ class FeatureContext implements Context
9
9
{
10
10
/** @var $now \Datetime */
11
11
private $ now ;
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace AlexisLefebvre \Bundle \AsyncTweetsBundle \Tests \Features \Context ;
4
+
5
+ use Behat \MinkExtension \Context \RawMinkContext ;
6
+
7
+ /**
8
+ * Class FeatureContextMink.
9
+ *
10
+ * @see https://github.com/jakzal/DemoBundle/blob/432e818097d9496223039eb28d79158daa216c6b/Features/Context/FeatureContext.php
11
+ */
12
+ class FeatureContextMink extends RawMinkContext
13
+ {
14
+ /**
15
+ * Initializes context.
16
+ */
17
+ public function __construct ()
18
+ {
19
+ }
20
+
21
+ /**
22
+ * @When I visit the index page
23
+ */
24
+ public function iVisitTheIndexPage ()
25
+ {
26
+ $ this ->getSession ()->visit ($ this ->locatePath ('/ ' ));
27
+ }
28
+
29
+ /**
30
+ * @Then I should see a body tag
31
+ */
32
+ public function iShouldSeeABodyTag ()
33
+ {
34
+ $ this ->assertSession ()->elementsCount (
35
+ 'css ' ,
36
+ 'html > body ' ,
37
+ 1
38
+ );
39
+ }
40
+
41
+ /**
42
+ * @Then I should see the title of the page
43
+ */
44
+ public function iShouldSeeTheTitleOfThePage ()
45
+ {
46
+ $ this ->assertSession ()->elementTextContains (
47
+ 'css ' ,
48
+ 'html > head > title ' ,
49
+ 'Home timeline '
50
+ );
51
+ }
52
+
53
+ /**
54
+ * @Then I should see the Tweets container
55
+ */
56
+ public function iShouldSeeTheTweetsContainer ()
57
+ {
58
+ $ this ->assertSession ()->elementsCount (
59
+ 'css ' ,
60
+ 'main.container > div.tweets ' ,
61
+ 1
62
+ );
63
+ }
64
+
65
+ /**
66
+ * @Then I should see the pending tweets
67
+ */
68
+ public function iShouldSeeThePendingTweets ()
69
+ {
70
+ $ this ->assertSession ()->elementTextContains (
71
+ 'css ' ,
72
+ 'body > main.container > div.navigation.row > div.col-sm-7.col-xs-12.count.alert.alert-info ' ,
73
+ 'pending tweets '
74
+ );
75
+ }
76
+ }
Original file line number Diff line number Diff line change
1
+ Feature : Test DefaultController
2
+
3
+ Scenario : Index
4
+ When I visit the index page
5
+ Then I should see a body tag
6
+ And I should see the title of the page
7
+ And I should see the pending tweets
Original file line number Diff line number Diff line change 3
3
default :
4
4
paths :
5
5
features : Tests/Features
6
- contexts : [AlexisLefebvre\Bundle\AsyncTweetsBundle\Tests\Features\bootstrap\FeatureContext]
6
+ contexts :
7
+ - ' AlexisLefebvre\Bundle\AsyncTweetsBundle\Tests\Features\Context\FeatureContext'
8
+ - ' AlexisLefebvre\Bundle\AsyncTweetsBundle\Tests\Features\Context\FeatureContextMink'
7
9
extensions :
8
10
Behat\Symfony2Extension :
9
11
# http://zalas.eu/run-behat-scenarios-and-functional-tests-from-symfony-bundle-in-isolation-of-project/
@@ -12,3 +14,7 @@ default:
12
14
debug : true
13
15
path : Tests/App/AppKernel.php
14
16
bootstrap : Tests/App/bootstrap.php
17
+ Behat\MinkExtension :
18
+ sessions :
19
+ default :
20
+ symfony2 : ~
Original file line number Diff line number Diff line change 24
24
"liip/functional-test-bundle" : " ~1.4" ,
25
25
"phpunit/phpunit" : " 4.8.* || ~5.1" ,
26
26
"behat/behat" : " ^3.2" ,
27
- "behat/symfony2-extension" : " ^2.1"
27
+ "behat/symfony2-extension" : " ^2.1" ,
28
+ "behat/mink" : " ^1.7" ,
29
+ "behat/mink-extension" : " ^2.2" ,
30
+ "behat/mink-browserkit-driver" : " ^1.3"
28
31
},
29
32
"autoload" : {
30
33
"psr-4" : {
You can’t perform that action at this time.
0 commit comments