Skip to content

Commit

Permalink
Tests: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
f3l1x committed Dec 13, 2023
1 parent ddf61bf commit c6e1241
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 32 deletions.
4 changes: 0 additions & 4 deletions tests/.coveralls.yml

This file was deleted.

10 changes: 0 additions & 10 deletions tests/.gitignore

This file was deleted.

23 changes: 10 additions & 13 deletions tests/Cases/DI/SchedulerExtension.phpt
Expand Up @@ -4,21 +4,20 @@ namespace Tests\Cases\DI;

use Contributte\Scheduler\DI\SchedulerExtension;
use Contributte\Scheduler\IScheduler;
use Contributte\Tester\Toolkit;
use Contributte\Tester\Utils\ContainerBuilder;
use Contributte\Tester\Utils\Neonkit;
use Nette\DI\Compiler;
use Nette\DI\Container;
use Nette\DI\ContainerLoader;
use Ninjify\Nunjuck\Toolkit;
use Tester\Assert;
use Tester\FileMock;

require_once __DIR__ . '/../../bootstrap.php';

// Custom parse case
Toolkit::test(function (): void {
$loader = new ContainerLoader(TEMP_DIR, true);
$class = $loader->load(function (Compiler $compiler): void {
$compiler->addExtension('scheduler', new SchedulerExtension());
$compiler->loadConfig(FileMock::create("
$container = ContainerBuilder::of()
->withCompiler(function (Compiler $compiler): void {
$compiler->addExtension('scheduler', new SchedulerExtension());
$compiler->addConfig(Neonkit::load(<<<'NEON'
services:
callbackJob: Tests\Fixtures\CallbackJob
scheduledJob: Tests\Fixtures\CustomJob
Expand All @@ -29,11 +28,9 @@ Toolkit::test(function (): void {
- {cron: '* * * * *', callback: [@callbackJob, bar]}
- Tests\Fixtures\CustomJob
- @scheduledJob
", 'neon'));
}, [getmypid(), 1]);

/** @var Container $container */
$container = new $class();
NEON
));
})->build();

$scheduler = $container->getByType(IScheduler::class);
Assert::type(IScheduler::class, $scheduler);
Expand Down
7 changes: 2 additions & 5 deletions tests/bootstrap.php
@@ -1,13 +1,10 @@
<?php declare(strict_types = 1);

use Ninjify\Nunjuck\Environment;
use Contributte\Tester\Environment;

if (@!include __DIR__ . '/../vendor/autoload.php') {
echo 'Install Nette Tester using `composer update --dev`';
exit(1);
}

// Configure environment
Environment::setupTester();
Environment::setupTimezone();
Environment::setupVariables(__DIR__);
Environment::setup(__DIR__);

0 comments on commit c6e1241

Please sign in to comment.