Skip to content

Commit

Permalink
Fix code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
vEnCa-X committed Dec 20, 2020
1 parent e17e7ff commit 4da5871
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 31 deletions.
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,18 @@ jobs:
- travis_retry composer create-project nette/code-checker temp/code-checker --no-progress
# Install Nette Coding Standard
- travis_retry composer create-project nette/coding-standard temp/coding-standard --no-progress

script:
- php temp/code-checker/code-checker -d src -d tests --short-arrays --strict-types
- php temp/coding-standard/ecs check src tests --preset php71


- stage: Code Coverage
php: 7.4
script:
- vendor/bin/tester -p phpdbg tests -s --coverage ./coverage.xml --coverage-src ./src
after_script:
- wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar
- wget https://github.com/php-coveralls/php-coveralls/releases/download/v1.0.1/coveralls.phar
- php coveralls.phar --verbose --config tests/.coveralls.yml


allow_failures:
- stage: Code Coverage
- env: title="Lowest Dependencies"
Expand Down
36 changes: 36 additions & 0 deletions tests/tests/Bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

declare(strict_types=1);

namespace Test;

use Nette\Configurator;


class Bootstrap
{
public static function boot(): Configurator
{
$configurator = new Configurator;

$configurator->setTimeZone('Europe/Prague');
$configurator->setTempDirectory(__DIR__ . '/temp');

$configurator->createRobotLoader()
->addDirectory(__DIR__ . '/../../src/')
->register();

$configurator
->addConfig(__DIR__ . '/config/config.neon');

return $configurator;
}


public static function bootForTests(): Configurator
{
$configurator = self::boot();
\Tester\Environment::setup();
return $configurator;
}
}
21 changes: 16 additions & 5 deletions tests/tests/InstanceTest.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,28 @@ declare(strict_types=1);

namespace Test;

use Nette;
use Tester;
use Tester\Assert;
use VencaX;

require __DIR__ . '/../../vendor/autoload.php';

class InstanceTest extends Tester\TestCase
{
/** @var VencaX\SocialLogin */
private $container;

private $socialLogin;


public function __construct(Nette\DI\Container $container)
{
$this->container = $container;
}


public function setUp()
{
$container = require __DIR__ . '/bootstrap.php';
$this->socialLogin = $container->getByType('VencaX\SocialLogin');
$this->socialLogin = $this->container->getByType('VencaX\SocialLogin');
}


Expand Down Expand Up @@ -72,5 +78,10 @@ class InstanceTest extends Tester\TestCase
}
}

$test = new InstanceTest;
require __DIR__ . '/Bootstrap.php';

$container = \Test\Bootstrap::bootForTests()
->createContainer();

$test = new InstanceTest($container);
$test->run();
22 changes: 0 additions & 22 deletions tests/tests/bootstrap.php

This file was deleted.

0 comments on commit 4da5871

Please sign in to comment.