|
| 1 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 2 | +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| 3 | + <head> |
| 4 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 5 | + <meta name="title" content="Codeception - BDD-style PHP testing framework" /> |
| 6 | + <title> Codeception - BDD-style PHP testing framework Collection of symfony framework tools - Symfohub: useful libs for symfony frameworks</title> |
| 7 | + <link rel="shortcut icon" href="/images/favicon.png" /> |
| 8 | + <link rel="stylesheet" type="text/css" media="screen" href="/css/screen.css" /> |
| 9 | +<link rel="stylesheet" type="text/css" media="screen" href="/css/twilight.css" /> |
| 10 | + </head> |
| 11 | + <body> |
| 12 | + <div id="root"> |
| 13 | + |
| 14 | + <div class="head"> |
| 15 | + |
| 16 | + <div class="nav"> |
| 17 | + <a class="logo" href="/" alt="Codeception">Codeception |
| 18 | + </a> |
| 19 | + <ul> |
| 20 | + <li><a class="" href="/repository">REPOSITORIES</a></li> |
| 21 | + |
| 22 | + </ul> |
| 23 | + </div> |
| 24 | + |
| 25 | + </div> |
| 26 | + |
| 27 | + <div class="layout"> |
| 28 | + <div class="content"> |
| 29 | + <div class="promo"> |
| 30 | + <div class="button"> |
| 31 | + <em>Start testing pragmatically</em> |
| 32 | + </div> |
| 33 | + <div class="disclaimer"> |
| 34 | + Test your PHP applications with fun! |
| 35 | + </div> |
| 36 | + </div> |
| 37 | + |
| 38 | + <div> |
| 39 | + <h1>Codeception</h1> |
| 40 | + |
| 41 | +<p>Codeception is new PHP full-stack testing framework. |
| 42 | +Inspired by BDD, it provides you absolutely new way for writing acceptance, functional and even unit tests. |
| 43 | +Powered by PHPUnit 3.6.</p> |
| 44 | + |
| 45 | +<p><a href="http://travis-ci.org/Codeception/codeception"><img src="https://secure.travis-ci.org/Codeception/Codeception.png?branch=master" alt="Build Status" /></a></p> |
| 46 | + |
| 47 | +<h3>In a Glance</h3> |
| 48 | + |
| 49 | +<p>Describe what you test and how you test it. Use PHP to write descriptions faster.</p> |
| 50 | + |
| 51 | +<p>Run tests and see what actions were taken and what results were seen.</p> |
| 52 | + |
| 53 | +<h4>Sample acceptance test</h4> |
| 54 | + |
| 55 | +<p>``` php |
| 56 | +<?php</p> |
| 57 | + |
| 58 | +<p>$I = new TestGuy($scenario); |
| 59 | +$I->wantTo('create wiki page'); |
| 60 | +$I->amOnPage('/'); |
| 61 | +$I->click('Pages'); |
| 62 | +$I->click('New'); |
| 63 | +$I->see('New Page'); |
| 64 | +$I->submitForm('#pageForm', array('page' => array(</p> |
| 65 | + |
| 66 | +<pre><code>'title' => 'Tree of Life Movie Review', |
| 67 | +'body' => 'Next time don\'t let Hollywood create arthouse =) ' |
| 68 | +</code></pre> |
| 69 | + |
| 70 | +<p>))); |
| 71 | +$I->see('page created'); // notice generated |
| 72 | +$I->see('Tree of Life Movie Review','h1'); // head of page of is our title |
| 73 | +$I->seeInCurrentUrl('pages/tree-of-life-mobie-review'); // slug is generated |
| 74 | +$I->seeInDatabase('pages', array('title' => 'Tree of Life Movie Review')); // data is stored in database |
| 75 | +?> |
| 76 | +``` |
| 77 | +Ok, as for unit test similar approach may seem weired, but... |
| 78 | +Take a look at this:</p> |
| 79 | + |
| 80 | +<h4>Sample unit test</h4> |
| 81 | + |
| 82 | +<p>``` php |
| 83 | +<?php |
| 84 | +class UserControllerCest {</p> |
| 85 | + |
| 86 | +<pre><code>public $class = 'UserController'; |
| 87 | + |
| 88 | +public function createAction(CodeGuy $I) |
| 89 | +{ |
| 90 | + $I->haveFakeClass($userController = Stub::make('UserController')); |
| 91 | + $I->executeTestedMethodOn($userController, array('username' => 'MilesDavis', 'email' => ' [email protected]')) |
| 92 | + ->seeResultEquals(true) |
| 93 | + ->seeMethodInvoked($userController, 'renderHtml') |
| 94 | + ->seeInDabatase('users', array('username' => 'MilesDavis')); |
| 95 | +} |
| 96 | +</code></pre> |
| 97 | + |
| 98 | +<p>} |
| 99 | +?></p> |
| 100 | + |
| 101 | +<p>```</p> |
| 102 | + |
| 103 | +<p>Anyway, If you don't really like writing unit tests in DSL, Codeceptance can run PHPUnit tests natively.</p> |
| 104 | + |
| 105 | +<h2>Documentation</h2> |
| 106 | + |
| 107 | +<p><a href="https://github.com/Codeception/Codeception/tree/master/docs">Documentation on Github</a></p> |
| 108 | + |
| 109 | +<p>Documentation is currently bounded with project. Look for it in 'docs' directory.</p> |
| 110 | + |
| 111 | +<h2>Installation</h2> |
| 112 | + |
| 113 | +<h3>PEAR</h3> |
| 114 | + |
| 115 | +<p>Install latest PEAR package from GitHub:</p> |
| 116 | + |
| 117 | +<p><code> |
| 118 | +pear channel-discover codeception.github.com/pear |
| 119 | +pear install codeception/Codeception |
| 120 | +</code></p> |
| 121 | + |
| 122 | +<h3>Phar</h3> |
| 123 | + |
| 124 | +<p>Download <a href="https://github.com/Codeception/Codeception/raw/master/package/codecept.phar">codecept.phar</a></p> |
| 125 | + |
| 126 | +<p>Copy it into your project. |
| 127 | +Run CLI utility:</p> |
| 128 | + |
| 129 | +<p><code> |
| 130 | +php codecept.phar |
| 131 | +</code></p> |
| 132 | + |
| 133 | +<h2>Getting Started</h2> |
| 134 | + |
| 135 | +<p>If you sucessfully installed Codeception, run this commands:</p> |
| 136 | + |
| 137 | +<p><code> |
| 138 | +codecept install |
| 139 | +</code></p> |
| 140 | + |
| 141 | +<p>this will install all dependency tools like PHPUnit and Mink</p> |
| 142 | + |
| 143 | +<p><code> |
| 144 | +codecept bootstrap |
| 145 | +</code></p> |
| 146 | + |
| 147 | +<p>this will create default directory structure and default test suites</p> |
| 148 | + |
| 149 | +<p><code> |
| 150 | +codecept build |
| 151 | +</code></p> |
| 152 | + |
| 153 | +<p>This will generate Guy-classes, in order to make autocomplete works.</p> |
| 154 | + |
| 155 | +<p>See Documentation for more information.</p> |
| 156 | + |
| 157 | +<h3>License</h3> |
| 158 | + |
| 159 | +<p>MIT</p> |
| 160 | + |
| 161 | +<p>(c) Michael Bodnarchuk "Davert" |
| 162 | +2011</p> |
| 163 | + |
| 164 | + </div> |
| 165 | + </div> |
| 166 | + <div class="sidebar"> |
| 167 | + <div class="inner"> |
| 168 | + </div> |
| 169 | + </div> |
| 170 | + </div> |
| 171 | + <div id="root_footer"></div> |
| 172 | + </div> |
| 173 | + |
| 174 | + <div id="footer"> |
| 175 | + <div class="inner"> |
| 176 | + |
| 177 | + <div class="col"> |
| 178 | + <div class="footnote"> |
| 179 | + <h4>Related links</h4> |
| 180 | + <h4>Powered by GitHub</h4> |
| 181 | + |
| 182 | + <div class="small"> |
| 183 | + Works with Jakyll and Github. |
| 184 | + </div> |
| 185 | + </div> |
| 186 | + |
| 187 | + </div> |
| 188 | + <div class="col"> |
| 189 | + <div class="footnote"> |
| 190 | + |
| 191 | + <h4>Codeception is...</h4> |
| 192 | + |
| 193 | + <div class="small"> |
| 194 | + |
| 195 | + Codeception is new PHP full-stack testing framework. Inspired by BDD, it provides you absolutely new way for writing acceptance, functional and even unit tests. Powered by PHPUnit 3.6. |
| 196 | + |
| 197 | + </div> |
| 198 | + |
| 199 | + </div> |
| 200 | + </div> |
| 201 | + <div class="col last"> |
| 202 | + <div class="footnote"> |
| 203 | + <h4>Credits</h4> |
| 204 | + |
| 205 | + <div class="small"> |
| 206 | + Symfohub was created by <a href="https://github.com/DavertMik" target="_blank">Davert</a>. |
| 207 | + <a href="http://dryicons.com">DryIcons</a> icons were used in design. |
| 208 | + </div> |
| 209 | + </div> |
| 210 | + </div> |
| 211 | + |
| 212 | + </div> |
| 213 | + </div> |
| 214 | +<script type="text/javascript"> |
| 215 | +var disqus_shortname = 'symfohub'; |
| 216 | +(function () { |
| 217 | + var s = document.createElement('script'); s.async = true; |
| 218 | + s.src = 'http://disqus.com/forums/symfohub/count.js'; |
| 219 | + (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); |
| 220 | +}()); |
| 221 | +</script> |
| 222 | + |
| 223 | +<script type="text/javascript"> |
| 224 | +var uservoiceOptions = { |
| 225 | + /* required */ |
| 226 | + key: 'symfohub', |
| 227 | + host: 'symfohub.uservoice.com', |
| 228 | + forum: '96525', |
| 229 | + showTab: true, |
| 230 | + /* optional */ |
| 231 | + alignment: 'left', |
| 232 | + background_color:'#656270', |
| 233 | + text_color: 'white', |
| 234 | + hover_color: '#06C', |
| 235 | + lang: 'en' |
| 236 | +}; |
| 237 | + |
| 238 | +function _loadUserVoice() { |
| 239 | + var s = document.createElement('script'); |
| 240 | + s.setAttribute('type', 'text/javascript'); |
| 241 | + s.setAttribute('src', ("https:" == document.location.protocol ? "https://" : "http://") + "cdn.uservoice.com/javascripts/widgets/tab.js"); |
| 242 | + document.getElementsByTagName('head')[0].appendChild(s); |
| 243 | +} |
| 244 | +_loadSuper = window.onload; |
| 245 | +window.onload = (typeof window.onload != 'function') ? _loadUserVoice : function() { _loadSuper(); _loadUserVoice(); }; |
| 246 | +</script> |
| 247 | + |
| 248 | + </body> |
| 249 | +</html> |
0 commit comments