Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
poo
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yusleidy Baquero Castañeda
poo
Commits
61432a0c
Commit
61432a0c
authored
Jul 02, 2021
by
William Torres
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed test
parent
ac37ccfb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
1 deletions
+49
-1
app/Temperature/Temperature.php
+24
-0
tests/OperacionesTest.php
+3
-1
tests/TemperatureTest.php
+22
-0
No files found.
app/Temperature/Temperature.php
0 → 100644
View file @
61432a0c
<?php
namespace
Sisoft\Temperature
;
use
External\Service
;
class
Temperature
{
private
$service
;
public
function
__construct
(
Service
$service
)
{
$this
->
service
=
$service
;
}
public
function
average
()
{
$total
=
0
;
for
(
$i
=
0
;
$i
<
3
;
$i
++
)
{
$total
+=
$this
->
service
->
leerTemperatura
();
}
return
$total
/
3
;
}
}
tests/OperacionesTest
s
.php
→
tests/OperacionesTest.php
View file @
61432a0c
<?php
namespace
Tests
;
use
InvalidArgumentException
;
use
PHPUnit\Framework\TestCase
;
use
Sisoft\Calculadora\Operaciones
;
use
Sisoft\Excepciones\MiPrimeraExcepcion
;
//TDD importante estudiar
class
OperacionesTest
s
extends
TestCase
class
OperacionesTest
extends
TestCase
{
private
$op
;
...
...
tests/TemperatureTest.php
0 → 100644
View file @
61432a0c
<?php
namespace
Tests
;
use
\Mockery
;
use
Sisoft\Temperature\Temperature
;
class
TemperatureTest
extends
\PHPUnit\Framework\TestCase
{
public
function
testGetsAverageTemperatureFromThreeServiceReadings
()
{
$service
=
Mockery
::
mock
(
'External\Service'
);
$service
->
shouldReceive
(
'leerTemperatura'
)
->
times
(
3
)
->
andReturn
(
12
,
10
,
14
);
$temperature
=
new
Temperature
(
$service
);
$this
->
assertEquals
(
12
,
$temperature
->
average
());
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment