1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
|
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!DOCTYPE html>
<html>
<head>
<title>Calculator (Codeception) - sample application for NetBeans IDE</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
/** general **/
* {
margin: 0;
padding: 0;
}
body {
font-family: Tahoma, Geneva, sans-serif;
font-size: 100%;
line-height: 1em;
color: #414141;
}
h1 {
margin-bottom: 30px;
}
h2 {
margin-bottom: 20px;
}
h3 {
font-size: 1em;
color: #4c7cbd;
margin-bottom: 12px;
}
h3 a {
color: #4c7cbd;
text-decoration: none;
}
h3 a:hover {
text-decoration: underline;
}
p {
margin: 0;
padding: 0;
}
.p {
margin-bottom: 14px;
}
a {
color: #414141;
outline: none;
}
a:hover {
text-decoration: none;
}
/** lists **/
ul {
list-style: circle;
}
li {
margin-left: 30px;
}
ul.list {
list-style: none;
}
.list li {
width: 100%;
overflow: hidden;
vertical-align: bottom;
padding: 3px 0 20px 0;
margin-left: 0;
}
.list li img {
float: left;
margin: -3px 15px 0 0;
width: 16px;
height: 16px;
}
.list p.description {
margin-bottom: 5px;
}
.list span.label {
font-weight: bold;
}
/** other **/
.fleft {
float: left;
}
.fright {
float: right;
}
.clear {
clear: both;
}
.wrapper {
width: 100%;
overflow: hidden;
}
#main {
width: 1000px;
margin: 0 auto;
position: relative;
}
#content, #footer {
font-size: 0.75em;
}
.col-1, .col-2, .col-3 {
float: left;
}
#page #content .col-1 {
width: 250px;
margin-right: 20px;
}
#page #content .col-2 {
width: 650px;
min-height: 500px;
}
#footer {
height: 89px;
}
/** content **/
#content {
padding: 20px 40px 0 40px;
}
#content .indent {
padding: 14px 0 0 9px;
}
#content p {
line-height: 1.17em;
}
/** footer **/
#footer .indent {
padding: 37px 40px 20px 40px;
}
#footer img {
position: relative; top: -4px;
}
#footer a {
color: #4c7cbd;
}
</style>
</head>
<body id="page">
<div id="main">
<!-- content -->
<div id="content">
<div class="wrapper">
<div class="col-2">
<div class="indent">
<h1>Calculator (Codeception)</h1>
<h2>NetBeans PHP Sample Application</h2>
<h3>What is Calculator?</h3>
<p class="p">Calculator is a simple calculator that supports basic arithmetical operations.
This PHP application is created to highlight PHP features supported by NetBeans IDE.
</p>
<p class="p">
<b>This sample is not intended to be used in a production environment without any changes.</b>
</p>
<h3>This sample demonstrates the following features:</h3>
<ul class="p">
<li>unit testing using Codeception</li>
<li>creating unit tests using <code>codecept generate:test command</code></li>
<li>code coverage of project files</li>
</ul>
<h3>Requirements</h3>
Follow these before you run the sample:
<ul class="p">
<li>Install NetBeans IDE with PHP support</li>
<li>Install and configure PHP Runtime</li>
<li>Install all dependencies using <a href="https://getcomposer.org/">Composer</a>
(click on project and invoke <i>Composer</i> > <i>Install (dev)</i>)<br>
<i>Note:</i> Codeception can also be installed <a href="http://codeception.com/install" target="_blank">globally as PHAR file</a></li>
<li>For debugging and code coverage, <a href="http://www.xdebug.org/">Xdebug</a> PHP extension is required</li>
</ul>
<h3>What is included?</h3>
<ul class="p">
<li>NetBeans <i>PHP Application</i> Project</li>
</ul>
<h3>Before the start</h3>
<ul class="p">
<li>If you want to try the sample out, follow <a href="#getting_started">Getting Started</a> guidelines.</li>
<li>In case if you want to try debugging features of the NetBeans IDE,
follow the <a href="#debugging">Debugging</a> guidelines.</li>
</ul>
<h3 id="getting_started">Getting Started</h3>
<ol class="p">
<li>
For the very first run, Codeception must be installed via Composer globally (see Requirements).
</li>
<li>
To initialize Codeception, Right-click the project node and select <i>Codeception > Bootstrap</i>.
</li>
<li>
Now, create a unit test for CalculatorEx class - open it in the editor
and select <i>Tools > Create/Update Tests</i>.
Then, select <i>test</i> command and <i>unit</i> suite in the Create Test dialog.
</li>
<li>
Add test cases for CalculatorEx class to the test class like CalculatorTest class.
</li>
<li>
To enable coverage put the below code in the unit suite configuration file <i>tests/unit.suite.yml</i>.
<pre><code>
coverage:
enabled: true
include:
- src/*
</code></pre>
</li>
<li>
Simply test the project. Right-click the project node and select <i>Test</i>.
IDE will inform you about the test results (window with test results can be opened manually).
</li>
<li>
For code coverage, open its report (right-click the project node and select <i>Code Coverage > Show Report...</i>)
and <i>Run All Tests</i> if there are no data available yet. Open <i>Calculator.php</i> file from the list of the files
to see which lines are and which lines are not tested.
</li>
<li>Play futher with the sample :)</li>
</ol>
<h3 id="debugging">Debugging</h3>
<p class="p">
These steps should enable you the debugging option at the sample project,
<a href="http://wiki.netbeans.org/HowToConfigureXDebug" target="_blank">if you already have PHP debugger (Xdebug)
installed and configured</a>.<br>
For demonstrating the PHP debugger in NetBeans, try the following:
</p>
<ol class="p">
<li>Open source class <i>Calculator.php</i> or <i>CalculatorTest.php</i> in the editor.</li>
<li>Put breakpoint on some line with PHP code.</li>
<li>To debug, right-click <i>CalculatorTest.php</i> and select <i>Debug</i>.</li>
</ol>
</div>
</div>
</div>
</div>
<!-- footer -->
<div id="footer">
<div class="indent">
<div class="fleft">2019 © Copyright The Apache Software Foundation, All rights reserved</div>
</div>
</div>
</div>
</body>
</html>
|