Skip to content

Commit cda94cd

Browse files
committed
added symfony for page
1 parent 540339b commit cda94cd

File tree

6 files changed

+164
-26
lines changed

6 files changed

+164
-26
lines changed

_includes/hero.html

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,3 @@ <h1>
3030
</div>
3131
</div>
3232

33-
<script>
34-
$(document).ready(function(){
35-
resizeDiv();
36-
});
37-
38-
window.onresize = function(event) {
39-
resizeDiv();
40-
}
41-
42-
function resizeDiv() {
43-
vph = $(window).height();
44-
$('#home-hero').css({'height': vph});
45-
}
46-
</script>
47-

_includes/symfony_hero.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,23 @@
33
<div class="wide">
44
<div class="container-fluid">
55
<div class="row">
6-
<div class="col-lg-8 col-sm-8 text-right">
6+
<div class="col-lg-8 col-sm-12 text-right">
77
<h1><div class="quiet">Codeception for</div><img src="/images/frameworks/symfony.png" alt="Symfony Framework" style="width: 70%; max-width: 800px;"></h1>
88

99
</div>
1010

11+
<div class="col-lg-4 col-sm-12">
12+
<div class="maintainer">
13+
<h4><a href="/docs/modules/Symfony">Symfony Module</a></h4>
14+
<p>Maintainer</p>
15+
<p><img src="https://avatars1.githubusercontent.com/u/76889?v=3&s=100" alt=""></p>
16+
<p><strong>Raul Ferriz</strong></p>
17+
<p><a href="https://github.com/raistlin">GitHub</a></p>
18+
<p>raistlin<img src="/images/email.png" alt="@" style="height: 14px;"> </p>
19+
</div>
20+
21+
22+
</div>
1123
</div>
1224

1325

_layouts/page.html

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,22 @@
1616

1717
<div class="col-sm-4 col-lg-4">
1818

19-
<div class="well">
20-
<a class="btn btn-lg btn-warning btn-block" href="/quickstart">Quick Start →</a>
21-
<p><br/>Write and execute a test for an existing app
22-
<b>in less then a 5 mins!</b>&nbsp;No additional tools required.&nbsp;
23-
</p>
24-
</div>
19+
{% if page.sidebar %}
20+
21+
22+
<div class="well sidebar">
23+
{{ page.sidebar | markdownify }}
24+
</div>
25+
{% else%}
26+
27+
<div class="well">
28+
<a class="btn btn-lg btn-warning btn-block" href="/quickstart">Quick Start →</a>
29+
<p><br/>Write and execute a test for an existing app
30+
<b>in less then a 5 mins!</b>&nbsp;No additional tools required.&nbsp;
31+
</p>
32+
</div>
33+
{% endif %}
34+
2535
<p>
2636
</p>
2737
<div class="links"> <a href="https://github.com/codeception/codeception">

css/codeception.css

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,23 @@ body #home-hero h1 {
7070
top:-7px;
7171
}
7272

73+
.maintainer a {
74+
color: #fff;
75+
}
76+
77+
.maintainer {
78+
border-left: 1px solid #ccc;
79+
padding-left: 2em;
80+
color: #ccc;
81+
float: right;
82+
}
83+
84+
.maintainer img {
85+
border-radius: 50px;
86+
width: 100px;
87+
height: 100px;
88+
}
89+
7390
#home-hero p.lead {
7491
color:#fff;
7592
}
@@ -294,7 +311,8 @@ ul.navbar-nav {
294311

295312
#home-hero{
296313
width:100%;
297-
height:800px;
314+
height:100vh;
315+
min-height: 800px;
298316
left:0px;
299317
// top:50px; /* space needed for navbar */
300318
background:#042943 no-repeat center center;
@@ -468,5 +486,24 @@ ul.navbar-nav {
468486
margin-right: 20px;
469487
width: 80px;
470488
margin-bottom: 10px;
489+
}
490+
491+
.sidebar {
492+
color: #000;
493+
background: #fff;
494+
border-bottom: 5px solid #666;
495+
}
496+
497+
.sidebar ul {
498+
font-size: 1.1em;
499+
list-style: none;
500+
padding-left: 0;
501+
line-height: 2;
502+
}
503+
504+
.sidebar ul li:before {
505+
content: "\2713";
506+
margin: 0 0.5em;
507+
}
471508

472-
}
509+
.sidebar ul li {}

for/symfony.md

Lines changed: 96 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22
layout: page
33
title: Codeception for Symfony
44
hero: symfony_hero.html
5+
sidebar: |
6+
7+
## Codeception Tests
8+
9+
* Combine **all testing levels** (acceptance, functional, unit)
10+
* **Fast**: Tests are wrapped into Doctrine transaction
11+
* **Scenario-Driven**: described in easy to get PHP DSL
12+
* Provide common actions and assertions
13+
* Great for **REST** and SOAP API testing
14+
15+
## Reference
16+
17+
* [Symfony Module](/docs/modules/Symfony)
18+
* [Demo Application](https://github.com/Codeception/symfony-demo)
19+
520
---
621

722
## Install
@@ -62,6 +77,18 @@ To generate method stubs for `AcceptanceTester`.
6277
php bin/codecept build
6378
```
6479
80+
81+
<div class="alert alert-warning">
82+
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
83+
Continue to <a href="http://codeception.com/docs/03-AcceptanceTests">Acceptance Testing Guide &raquo;</a>
84+
</div>
85+
86+
To run the tests you will need firefox browser, [selenium server running](http://codeception.com/docs/modules/WebDriver#Selenium). If this requirements met acceptance tests can be executed as
87+
88+
```
89+
php bin/codecept run acceptance
90+
```
91+
6592
### BDD
6693
6794
If you prefer to describe application with feature files, Codeception can turn them to acceptance tests. It is recommended to store feature files in `features` directory (like it does Behat) but symlinking it to `tests/acceptance/features` so they can be treated as tests too.
@@ -78,6 +105,11 @@ There is no standard Gherkin steps built in. By writing your feature files you c
78105
php bin/codecept gherkin:snippets
79106
```
80107
108+
<div class="alert alert-warning">
109+
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
110+
Continue to <a href="http://codeception.com/docs/07-BDD">Behavior Driven Development Guide &raquo;</a>
111+
</div>
112+
81113
## Bundle Setup
82114
83115
Each bundle should have its own Codeception setup. To have test configuration for `AppBundle` you should run:
@@ -88,10 +120,72 @@ php bin/codecept bootstrap --empty src/AppBundle --namespace AppBundle
88120
89121
This will create `tests` dir inside `src/AppBundle`.
90122
123+
### Functional Testing
124+
125+
There is no need to use `WebTestCase` to write functional tests. Symfony functional tests aew written in the same manner as acceptance tests but are executed inside a framework. Codeception has `Symfony` module for it. It is a good idea to separate functional and unit tests so it is recommended to create a new test suite for AppBundle
126+
127+
```
128+
php bin/codecept g:suite functional -c src/AppBundle
129+
```
130+
131+
Functional tests are written in the same manner as acceptance tests. They also use scenario and `$I` actor object. The only difference is how they are executed. To run tests as Symfony test you should enable corresponding module in functional suite configureation file `src/Appundle/tests/functional.suite.yml`. Probably you want Doctrine to be included as well. Then you should use this configuration:
132+
133+
```yaml
134+
class_name: FunctionalTester
135+
modules:
136+
enabled:
137+
- Symfony2:
138+
app_path: '../../app'
139+
var_path: '../../app'
140+
- Doctrine2:
141+
depends: Symfony2
142+
- \AcmeBundle\Helper\Functional
143+
```
144+
145+
<div class="alert alert-warning">
146+
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
147+
Learn more about starting with Symfony in <a href="http://codeception.com/09-04-2015/using-codeception-for-symfony-projects.html">our blogpost &raquo;</a>
148+
</div>
149+
150+
<div class="alert alert-warning">
151+
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
152+
Continue to <a href="http://codeception.com/docs/04-FunctionalTests">Functional Testing Guide &raquo;</a>
153+
</div>
154+
155+
91156
### Unit Testing
92157

158+
You should put your unit tests for AppBundle into `src/AppBundle/tests/unit`. It is done to not mix them with functional and API tests. To start unit test suite for `AppBundle` shoule be created:
93159

160+
```
161+
php bin/codecept g:suite unit -c src/AppBundle
162+
```
94163

95-
### Functional Testing
164+
Codeception is powered by PHPUnit so unit and integration test work in a similar manner. To genereate a plain PHPUnit test for `Foo` class inside `AppBundle` please run
165+
166+
```
167+
php bin/codecept g:phpunit unit Foo -c src/AppBundle
168+
```
169+
170+
This generates a standard test inherited from `PHPUnit_Framework_TestCase`. For integration tests you may use Codeception-enhanced format which allows accessing services DI container, Doctrine, and others. To have it create a unit test extending `Codeception\Test\Unit` class:
171+
172+
```
173+
php bin/codecept g:test unit Foo -c src/AppBundle
174+
```
175+
176+
<div class="alert alert-warning">
177+
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
178+
Continue to <a href="http://codeception.com/docs/05-UnitTests">Unit Testing Guide &raquo;</a>.
179+
</div>
180+
181+
182+
### Running it all together
183+
184+
Codeception allows to execute all tests with different configurations in one runner. To execute all tests at once with `codecept run` you should include bundle configurations into global configuration file `codeception.yml` in the root of a project:
185+
186+
```yaml
187+
include:
188+
- src/*Bundle
189+
```
96190
97-
There is no need to use `WebTestCase`
191+
Then running codeception tests from root directory will execute tests from all bundles as well as acceptance tests.

images/email.png

1.92 KB
Loading

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy