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
49b11b0a
Commit
49b11b0a
authored
Jul 01, 2021
by
Yusleidy Baquero Castañeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajustes
Ajustes
parent
5241b0fa
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
63 deletions
+8
-63
app/Calculadora/Operaciones.php
+4
-2
app/tests/OperacionesTests.php
+0
-58
tests/OperacionesTests.php
+4
-3
No files found.
app/Calculadora/Operaciones.php
View file @
49b11b0a
<?php
<?php
namespace
Sisoft\Calculadora
;
namespace
Sisoft\Calculadora
;
use
InvalidArgumentException
;
use
InvalidArgumentException
;
use
Sisoft\Excepciones\MiPrimeraExcepcion
;
use
Sisoft\Excepciones\MiPrimeraExcepcion
;
//cuidado con adicionar parametros
//cuidado con adicionar parametros
//para probar en el git bash vendor/bin/phpunit tests/OperacionesTests.php --colors
//para probar en el git bash vendor/bin/phpunit tests/OperacionesTests.php --colors
class
Operaciones
{
class
Operaciones
{
public
function
sumar
(
$parametro1
,
$parametro2
)
public
function
sumar
(
$parametro1
,
$parametro2
)
{
{
...
@@ -30,5 +33,4 @@ class Operaciones {
...
@@ -30,5 +33,4 @@ class Operaciones {
}
}
return
(
$parametro1
/
$parametro2
);
return
(
$parametro1
/
$parametro2
);
}
}
}
}
app/tests/OperacionesTests.php
deleted
100644 → 0
View file @
5241b0fa
<?php
namespace
Tests
;
use
InvalidArgumentException
;
use
PHPUnit\Framework\TestCase
;
use
Sisoft\Calculadora\Operaciones
;
use
Sisoft\Excepciones\MiPrimeraExcepcion
;
//TDD importante estudiar
class
OperacionesTests
extends
TestCase
{
private
$op
;
public
function
setup
()
:
void
{
$this
->
op
=
new
Operaciones
();
}
public
function
testSumarConDosValores
()
{
$this
->
assertSame
(
7
,
$this
->
op
->
sumar
(
'2'
,
'5'
));
}
public
function
testSumarConValoresNulos
()
{
$this
->
expectException
(
MiPrimeraExcepcion
::
class
);
$this
->
op
->
sumar
(
NULL
,
NULL
);
}
public
function
testSumarConValoresVarchar
()
{
$this
->
expectException
(
InvalidArgumentException
::
class
);
$this
->
op
->
sumar
(
"dos"
,
"siete"
);
}
public
function
testDividirConDosValores
()
{
$this
->
expectException
(
InvalidArgumentException
::
class
);
$this
->
assertEquals
(
8
,
$this
->
op
->
dividir
(
6
,
0
));
/* next class
$payload = [
'first_name' => $this->faker->firstName,
'last_name' => $this->faker->lastName,
'email' => $this->faker->email
];
$this->json('post', 'api/user', $payload)
->assertStatus(Response::HTTP_CREATED)
->assertJsonStructure(
[
'message' => [
'id',
'first_name',
'last_name',
'email',
'created_at',]]);
*/
}
}
tests/OperacionesTests.php
View file @
49b11b0a
...
@@ -4,8 +4,10 @@ use InvalidArgumentException;
...
@@ -4,8 +4,10 @@ use InvalidArgumentException;
use
PHPUnit\Framework\TestCase
;
use
PHPUnit\Framework\TestCase
;
use
Sisoft\Calculadora\Operaciones
;
use
Sisoft\Calculadora\Operaciones
;
use
Sisoft\Excepciones\MiPrimeraExcepcion
;
use
Sisoft\Excepciones\MiPrimeraExcepcion
;
//TDD importante estudiar
//TDD importante estudiar
class
OperacionesTests
extends
TestCase
{
class
OperacionesTests
extends
TestCase
{
private
$op
;
private
$op
;
...
@@ -22,7 +24,7 @@ class OperacionesTests extends TestCase {
...
@@ -22,7 +24,7 @@ class OperacionesTests extends TestCase {
public
function
testSumarConValoresNulos
()
public
function
testSumarConValoresNulos
()
{
{
$this
->
expectException
(
MiPrimeraExcepcion
::
class
);
$this
->
expectException
(
MiPrimeraExcepcion
::
class
);
$this
->
op
->
sumar
(
NULL
,
NULL
);
$this
->
op
->
sumar
(
null
,
null
);
}
}
public
function
testSumarConValoresVarchar
()
public
function
testSumarConValoresVarchar
()
...
@@ -54,5 +56,4 @@ class OperacionesTests extends TestCase {
...
@@ -54,5 +56,4 @@ class OperacionesTests extends TestCase {
*/
*/
}
}
}
}
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