Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/App/Enums/ExitCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,34 @@

declare(strict_types=1);

/**
* Quantum PHP Framework
*
* An open source software development framework for PHP
*
* @package Quantum
* @author Arman Ag. <arman.ag@softberg.org>
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
* @link http://quantum.softberg.org/
* @since 3.0.0
*/

namespace Quantum\App\Enums;

/**
* Class ExitCode
* @package Quantum\App
Comment thread
armanist marked this conversation as resolved.
* @codeCoverageIgnore
*/
final class ExitCode
{
public const SUCCESS = 0;

public const FAILURE = 1;

public const INVALID = 2;

private function __construct()
{
}
}
34 changes: 0 additions & 34 deletions src/App/Exceptions/StopExecutionException.php

This file was deleted.

16 changes: 0 additions & 16 deletions src/App/Helpers/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,3 @@
* @link http://quantum.softberg.org/
* @since 3.0.0
*/

use Quantum\App\Exceptions\StopExecutionException;

/**
* Stops the app execution
* @return never
* @throws StopExecutionException
*/
function stop(?Closure $closure = null, ?int $code = 0): void
{
if ($closure instanceof Closure) {
$closure();
}

throw StopExecutionException::executionTerminated($code);
}
13 changes: 4 additions & 9 deletions tests/Unit/Http/Helpers/HttpHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Quantum\Tests\Unit\Http\Helpers;

use Quantum\App\Exceptions\StopExecutionException;
use Quantum\Session\Factories\SessionFactory;
use Quantum\Tests\Unit\AppTestCase;
use Quantum\Router\RouteCollection;
Expand Down Expand Up @@ -104,11 +103,9 @@ public function testRedirecting(): void
{
$this->assertFalse($this->response->hasHeader('Location'));

try {
redirect('/home');
} catch (StopExecutionException $e) {
$redirectResponse = redirect('/home');

}
$this->assertSame($this->response, $redirectResponse);

$this->assertTrue($this->response->hasHeader('Location'));

Expand All @@ -121,11 +118,9 @@ public function testRedirectWithOldData(): void

$this->request->create('POST', '/', ['firstname' => 'Josh', 'lastname' => 'Doe']);

try {
redirectWith('/signup', $this->request->all());
} catch (StopExecutionException $e) {
$redirectResponse = redirectWith('/signup', $this->request->all());

}
$this->assertSame($this->response, $redirectResponse);

$this->assertTrue($this->response->hasHeader('Location'));

Expand Down
Loading