Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JosueUPT committed Dec 11, 2024
1 parent fd766c8 commit f903baf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 5 additions & 1 deletion tests/Mutation/AdminControllerMutationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@ class AdminControllerMutationTest extends TestCase
protected $stmt;
protected $pdo;


/** @test */
public function dummy_test(): void
{
$this->assertTrue(true);
}
}
13 changes: 12 additions & 1 deletion tests/Unit/Controllers/UserControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,24 @@ protected function setUp(): void
if (session_status() === PHP_SESSION_NONE) {
@session_start();
}
$this->mockPDO = $this->createMock(\PDO::class);

// Configurar el mock de PDO para que no intente conexiones reales
$this->mockPDO = $this->createMock(PDO::class);
$this->mockPDO->method('prepare')
->willReturnCallback(function() {
$stmt = $this->createMock(PDOStatement::class);
$stmt->method('execute')->willReturn(true);
$stmt->method('fetch')->willReturn(false);
return $stmt;
});

$this->userController = new UserController($this->mockPDO);
}

protected function tearDown(): void
{
parent::tearDown();
$_SESSION = array(); // Limpiar la sesión entre pruebas
if (session_status() === PHP_SESSION_ACTIVE) {
session_destroy();
}
Expand Down

0 comments on commit f903baf

Please sign in to comment.