Skip to content
Permalink
Browse files

//

  • Loading branch information
rodolfoberrios committed Feb 11, 2020
1 parent f0ddc75 commit db5f98435162a5efaff179b1377784bd7ab52a2e
Showing with 65 additions and 36 deletions.
  1. +3 −0 .vscode/settings.json
  2. +1 −1 bootstrap.php
  3. +1 −1 components/Benchmark/Run.php
  4. +17 −6 components/ExceptionHandler/Tests/Formatters/ConsoleFormatterTest.php
  5. +1 −1 components/Filesystem/AppPath.php
  6. +1 −1 components/Filesystem/PhpFile.php
  7. +1 −1 components/Filesystem/Tests/AppPathTest.php
  8. +1 −1 components/Filesystem/Tests/PathTest.php
  9. +1 −1 components/{App → }/Instances/BootstrapInstance.php
  10. +1 −1 components/{App → }/Instances/RequestInstance.php
  11. +1 −1 components/{App → }/Instances/RuntimeInstance.php
  12. +1 −1 components/{App → }/Instances/ScreenContainerInstance.php
  13. +1 −1 components/Message/Tests/MessageTest.php
  14. +11 −2 components/Str/Str.php
  15. +8 −2 components/VarDump/Tests/Outputters/ConsoleOutputterTest.php
  16. +2 −2 components/VarDump/Tests/Outputters/HtmlOutputterTest.php
  17. 0 ...nts/VarDump/Tests/Outputters/{resources/output-console.php → _resources/output-console-color.php}
  18. 0 components/VarDump/Tests/Outputters/{resources → _resources}/output-html.php
  19. +1 −1 components/VarDump/VarDump.php
  20. +2 −2 phpunit.php
  21. +1 −1 resources/functions/screens.php
  22. +2 −2 runtime.php
  23. 0 {components → trash}/Api/Api.php
  24. 0 {components → trash}/Api/ApiMaker.php
  25. 0 {components → trash}/Api/CacheKeys.php
  26. 0 {components → trash}/Api/Endpoint.php
  27. 0 {components → trash}/Api/Interfaces/ApiInterface.php
  28. 0 {components → trash}/Api/Interfaces/ApiMakerInterface.php
  29. 0 {components → trash}/Api/Interfaces/EndpointInterface.php
  30. 0 {components → trash}/Api/Interfaces/src/FilterIteratorInterface.php
  31. 0 {components → trash}/Api/src/FilterIterator.php
  32. +1 −1 {components → trash}/App/App.php
  33. 0 {components → trash}/App/Build.php
  34. 0 {components → trash}/App/Builder.php
  35. 0 {components → trash}/App/Checkout.php
  36. 0 {components → trash}/App/ControllerRunner.php
  37. 0 {components → trash}/App/Exceptions/AppWithoutRequestException.php
  38. 0 {components → trash}/App/Exceptions/BuildAlreadyMakedException.php
  39. 0 {components → trash}/App/Exceptions/BuildFileNotExistsException.php
  40. 0 {components → trash}/App/Exceptions/BuildNeededException.php
  41. 0 {components → trash}/App/Exceptions/ControllerInterfaceException.php
  42. 0 {components → trash}/App/Exceptions/ControllerNotExistsException.php
  43. 0 {components → trash}/App/Exceptions/ParametersDuplicatedException.php
  44. 0 {components → trash}/App/Exceptions/ParametersWrongKeyException.php
  45. 0 {components → trash}/App/Exceptions/ParametersWrongTypeException.php
  46. 0 {components → trash}/App/Exceptions/RequestRequiredException.php
  47. 0 {components → trash}/App/Exceptions/ResolverException.php
  48. 0 {components → trash}/App/Exceptions/RouterCantResolveException.php
  49. 0 {components → trash}/App/Exceptions/RouterRequiredException.php
  50. 0 {components → trash}/App/Interfaces/AppInterface.php
  51. 0 {components → trash}/App/Interfaces/BuildInterface.php
  52. 0 {components → trash}/App/Interfaces/BuilderInterface.php
  53. 0 {components → trash}/App/Interfaces/CheckoutInterface.php
  54. 0 {components → trash}/App/Interfaces/ControllerRunnerInterface.php
  55. 0 {components → trash}/App/Interfaces/LoaderInterface.php
  56. 0 {components → trash}/App/Interfaces/MiddlewareRunnerInterface.php
  57. 0 {components → trash}/App/Interfaces/ParametersInterface.php
  58. 0 {components → trash}/App/Interfaces/ResolvableInterface.php
  59. 0 {components → trash}/App/Interfaces/ResolverInterface.php
  60. 0 {components → trash}/App/Interfaces/RunnerInterface.php
  61. 0 {components → trash}/App/Interfaces/ServicesBuilderInterface.php
  62. 0 {components → trash}/App/Interfaces/ServicesInterface.php
  63. +1 −1 {components → trash}/App/Loader.php
  64. 0 {components → trash}/App/MiddlewareRunner.php
  65. 0 {components → trash}/App/Parameters.php
  66. 0 {components → trash}/App/Resolvable.php
  67. 0 {components → trash}/App/Resolver.php
  68. +1 −1 {components → trash}/App/Runner.php
  69. 0 {components → trash}/App/Services.php
  70. 0 {components → trash}/App/ServicesBuilder.php
  71. 0 {components → trash}/App/Tests/AppTest.php
  72. 0 {components → trash}/App/Tests/BuildTest.php
  73. 0 {components → trash}/App/Tests/BuilderTest.php
  74. 0 {components → trash}/App/Tests/CheckoutTest.php
  75. 0 {components → trash}/App/Tests/ControllerRunnerTest.php
  76. 0 {components → trash}/App/Tests/MiddlewareRunnerTest.php
  77. 0 {components → trash}/App/Tests/ParametersTest.php
  78. 0 {components → trash}/App/Tests/ResolvableTest.php
  79. 0 {components → trash}/App/Tests/ResolverTest.php
  80. 0 {components → trash}/App/Tests/RunnerTest.php
  81. 0 {components → trash}/App/Tests/ServicesBuilderTest.php
  82. 0 {components → trash}/App/Tests/ServicesTest.php
  83. 0 {components → trash}/App/Tests/routes/0.php
  84. 0 {components → trash}/ArrayFile/ArrayFile.php
  85. 0 {components → trash}/ArrayFile/Exceptions/ArrayFileTypeException.php
  86. 0 {components → trash}/ArrayFile/Interfaces/ArrayFileInterface.php
  87. 0 {components → trash}/ArrayFile/Tests/ArrayFileTest.php
  88. +1 −1 trash/Console/Commands/BuildCommand.php
  89. +1 −1 trash/Controllers/Api/OptionsController.php
  90. +1 −1 trash/Controllers/ExceptionHandler/Output.php
  91. +1 −1 trash/JsonApi/EncodedDocument.php
@@ -0,0 +1,3 @@
{
"phpunit.files": "components/**/Tests/*Test.php"
}
@@ -13,7 +13,7 @@

namespace Chevere;

use Chevere\Components\App\Instances\BootstrapInstance;
use Chevere\Components\Instances\BootstrapInstance;
use Chevere\Components\Bootstrap\Bootstrap;
use Chevere\Components\Console\Console;
use Chevere\Components\Filesystem\Dir\Dir;
@@ -16,7 +16,7 @@
use ArgumentCountError;
use TypeError;
use DateTime;
use Chevere\Components\App\Instances\BootstrapInstance;
use Chevere\Components\Instances\BootstrapInstance;
use JakubOnderka\PhpConsoleColor\ConsoleColor;
use Chevere\Components\Benchmark\Interfaces\RunInterface;
use Chevere\Components\Benchmark\Interfaces\RunableInterface;
@@ -1,8 +1,21 @@
<?php

/*
* This file is part of Chevere.
*
* (c) Rodolfo Berrios <rodolfo@chevere.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Chevere\Components\ExceptionHandler\Tests\Formatters;

use Chevere\Components\ExceptionHandler\Formatters\ConsoleFormatter;
use Chevere\Components\ExceptionHandler\Formatters\PlainFormatter;
use Chevere\Components\Str\Str;
use PHPUnit\Framework\TestCase;

final class ConsoleFormatterTest extends TestCase
@@ -22,12 +35,10 @@ public function testConstruct(): void
$plain = $plainFormatter->$methodName(...$args);
$console = $consoleFormatter->$methodName(...$args);
$this->assertTrue(strlen($plain) < strlen($console));
$this->assertSame($plain, $this->uncolorizeConsole($console));
$this->assertSame(
$plain,
(string) (new Str($console))->stripANSIColors()
);
}
}

private function uncolorizeConsole(string $string): string
{
return preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $string);
}
}
@@ -13,7 +13,7 @@

namespace Chevere\Components\Filesystem;

use Chevere\Components\App\Instances\BootstrapInstance;
use Chevere\Components\Instances\BootstrapInstance;
use Chevere\Components\Filesystem\Interfaces\Dir\DirInterface;
use Chevere\Components\Message\Message;
use Chevere\Components\Filesystem\Exceptions\Path\PathNotAllowedException;
@@ -13,7 +13,7 @@

namespace Chevere\Components\Filesystem;

use Chevere\Components\App\Instances\BootstrapInstance;
use Chevere\Components\Instances\BootstrapInstance;
use Chevere\Components\Filesystem\Exceptions\File\FileNotPhpException;
use Chevere\Components\Message\Message;
use Chevere\Components\Filesystem\Interfaces\File\FileInterface;
@@ -14,7 +14,7 @@
namespace Chevere\Components\Filesystem\Path\Tests;

use RuntimeException;
use Chevere\Components\App\Instances\BootstrapInstance;
use Chevere\Components\Instances\BootstrapInstance;
use Chevere\Components\Filesystem\Interfaces\Dir\DirInterface;
use Chevere\Components\Filesystem\Exceptions\Path\PathDotSlashException;
use Chevere\Components\Filesystem\Exceptions\Path\PathInvalidException;
@@ -14,7 +14,7 @@
namespace Chevere\Components\Filesystem\Path\Tests;

use RuntimeException;
use Chevere\Components\App\Instances\BootstrapInstance;
use Chevere\Components\Instances\BootstrapInstance;
use Chevere\Components\Filesystem\Exceptions\Path\PathDoesntExistsException;
use Chevere\Components\Filesystem\Path;
use Chevere\Components\Filesystem\Interfaces\Path\PathInterface;
@@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Chevere\Components\App\Instances;
namespace Chevere\Components\Instances;

use Chevere\Components\Bootstrap\Interfaces\BootstrapInterface;
use LogicException;
@@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Chevere\Components\App\Instances;
namespace Chevere\Components\Instances;

use LogicException;
use Chevere\Components\Http\Interfaces\RequestInterface;
@@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Chevere\Components\App\Instances;
namespace Chevere\Components\Instances;

use Chevere\Components\Runtime\Runtime;
use LogicException;
@@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Chevere\Components\App\Instances;
namespace Chevere\Components\Instances;

use LogicException;
use Chevere\Components\Screen\Container;
@@ -13,7 +13,7 @@

namespace Chevere\Components\Message\Tests;

use Chevere\Components\App\Instances\BootstrapInstance;
use Chevere\Components\Instances\BootstrapInstance;
use Chevere\Components\Message\Message;
use PHPUnit\Framework\TestCase;

@@ -110,8 +110,7 @@ public function replaceFirst(string $search, string $replace): StrInterface
}

/**
* Replace the last occurrence of the search string with the replacement
* string.
* Replace the last occurrence of the search string with the replacement string.
*
* @param string $search value being searched for
* @param string $replace replacement value that replaces found search values
@@ -127,4 +126,14 @@ public function replaceLast(string $search, string $replace): StrInterface

return $this;
}

/**
* Removes CLI color format.
*/
public function stripANSIColors(): StrInterface
{
$this->string = preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $this->string);

return $this;
}
}
@@ -17,12 +17,14 @@
use Chevere\Components\Filesystem\PhpFile;
use Chevere\Components\Filesystem\FileReturn;
use Chevere\Components\Filesystem\Path;
use Chevere\Components\Str\Str;
use Chevere\Components\VarDump\Formatters\ConsoleFormatter;
use Chevere\Components\VarDump\Formatters\PlainFormatter;
use Chevere\Components\VarDump\Outputters\ConsoleOutputter;
use Chevere\Components\VarDump\Outputters\HtmlOutputter;
use Chevere\Components\VarDump\VarDumper;
use Chevere\Components\Variable\VariableExport;
use JakubOnderka\PhpConsoleColor\ConsoleColor;
use PHPUnit\Framework\TestCase;

final class ConsoleOutputterTest extends TestCase
@@ -34,11 +36,15 @@ public function testEmpty(): void
$line = __LINE__ - 2;
// $fileReturn = new FileReturn(
// new PhpFile(new File(
// new Path(__DIR__ . '/resources/output-console.php')
// new Path(__DIR__ . '/_resources/output-console.php')
// ))
// );
// $fileReturn->put(new VariableExport($outputter->toString()));
$parsed = strtr(include 'resources/output-console.php', [
$expected = include '_resources/output-console-color.php';
if ((new ConsoleColor())->isSupported() === false) {
$expected = (new Str($expected))->stripANSIColors();
}
$parsed = strtr($expected, [
'%varDumperClassName%' => VarDumper::class,
'%className%' => self::class,
'%functionName%' => __FUNCTION__,
@@ -32,11 +32,11 @@ public function testEmpty(): void
$line = __LINE__ - 2;
// $fileReturn = new FileReturn(
// new PhpFile(new File(
// new Path(__DIR__ . '/resources/output-html.php')
// new Path(__DIR__ . '/_resources/output-html.php')
// ))
// );
// $fileReturn->put(new VariableExport($outputter->toString()));
$parsed = strtr(include 'resources/output-html.php', [
$parsed = strtr(include '_resources/output-html.php', [
'%className%' => self::class,
'%functionName%' => __FUNCTION__,
'%fileLine%' => __FILE__ . ':' . $line
@@ -13,7 +13,7 @@

namespace Chevere\Components\VarDump;

use Chevere\Components\App\Instances\BootstrapInstance;
use Chevere\Components\Instances\BootstrapInstance;
use Chevere\Components\Common\Interfaces\ToStringInterface;
use Chevere\Components\VarDump\Formatters\ConsoleFormatter;
use Chevere\Components\VarDump\Formatters\HtmlFormatter;
@@ -13,8 +13,8 @@

namespace Chevere;

use Chevere\Components\App\Instances\BootstrapInstance;
use Chevere\Components\App\Instances\ScreenContainerInstance;
use Chevere\Components\Instances\BootstrapInstance;
use Chevere\Components\Instances\ScreenContainerInstance;
use Chevere\Components\Bootstrap\Bootstrap;
use Chevere\Components\Filesystem\Dir;
use Chevere\Components\Filesystem\Path;
@@ -11,7 +11,7 @@

declare(strict_types=1);

use Chevere\Components\App\Instances\ScreenContainerInstance;
use Chevere\Components\Instances\ScreenContainerInstance;
use Chevere\Components\Screen\Interfaces\ScreenContainerInterface;

function screens(): ScreenContainerInterface
@@ -13,8 +13,8 @@

namespace Chevere;

use Chevere\Components\App\Instances\RequestInstance;
use Chevere\Components\App\Instances\RuntimeInstance;
use Chevere\Components\Instances\RequestInstance;
use Chevere\Components\Instances\RuntimeInstance;
use Chevere\Components\Http\Request;
use Chevere\Components\Runtime\Runtime;
use Chevere\Components\Runtime\Sets\SetDebug;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -13,7 +13,7 @@

namespace Chevere\Components\App;

use Chevere\Components\App\Instances\RequestInstance;
use Chevere\Components\Instances\RequestInstance;
use Chevere\Components\App\Interfaces\AppInterface;
use Chevere\Components\App\Interfaces\ServicesInterface;
use Chevere\Components\Http\Interfaces\RequestInterface;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -15,7 +15,7 @@

use Chevere\Components\Api\Api;
use Chevere\Components\App\Exceptions\BuildNeededException;
use Chevere\Components\App\Instances\BootstrapInstance;
use Chevere\Components\Instances\BootstrapInstance;
use Chevere\Components\ArrayFile\ArrayFile;
use Chevere\Components\Cache\Exceptions\CacheNotFoundException;
use Chevere\Components\Filesystem\File;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -15,7 +15,7 @@

use LogicException;
use Chevere\Components\App\Exceptions\ResolverException;
use Chevere\Components\App\Instances\BootstrapInstance;
use Chevere\Components\Instances\BootstrapInstance;
use Chevere\Components\Http\Request\RequestException;
use Chevere\Components\Http\Request;
use Chevere\Components\Message\Message;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -13,7 +13,7 @@

namespace Chevere\Components\Console\Commands;

use Chevere\Components\App\Instances\BootstrapInstance;
use Chevere\Components\Instances\BootstrapInstance;
use LogicException;
use Chevere\Components\Console\Command;
use Chevere\Components\Message\Message;
@@ -13,7 +13,7 @@

namespace Chevere\Components\Controllers\Api;

use Chevere\Components\App\Instances\BootstrapInstance;
use Chevere\Components\Instances\BootstrapInstance;
use InvalidArgumentException;
use Chevere\Components\Controller\Controller;
use Chevere\Components\Message\Message;
@@ -13,7 +13,7 @@

namespace Chevere\Components\ExceptionHandler\src;

use Chevere\Components\App\Instances\BootstrapInstance;
use Chevere\Components\Instances\BootstrapInstance;
use JsonApiPhp\JsonApi\Error;
use JsonApiPhp\JsonApi\ErrorDocument;
use JsonApiPhp\JsonApi\Error\Code;
@@ -13,7 +13,7 @@

namespace Chevere\Components\JsonApi;

use Chevere\Components\App\Instances\BootstrapInstance;
use Chevere\Components\Instances\BootstrapInstance;
use InvalidArgumentException;
use JsonException;
use JsonSerializable;

0 comments on commit db5f984

Please sign in to comment.
You can’t perform that action at this time.