Skip to content

Commit 511ed72

Browse files
committed
Tests: redefine
1 parent 5eec62a commit 511ed72

6 files changed

Lines changed: 26 additions & 20 deletions

File tree

.github/workflows/main.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,15 @@ jobs:
222222

223223
if: "github.event_name == 'push'"
224224

225+
services:
226+
mysql:
227+
image: mysql:5.7
228+
env:
229+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
230+
MYSQL_DATABASE: tests
231+
ports:
232+
- 3306:3306
233+
225234
steps:
226235
- name: "Checkout"
227236
uses: "actions/checkout@v2"

tests/.coveralls.yml

100755100644
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# for php-coveralls
2-
service_name: travis-ci
2+
service_name: github-actions
33
coverage_clover: coverage.xml
4-
json_path: coverage.json
4+
json_path: coverage.json

tests/bootstrap.container.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
host: 127.0.0.1
2626
username: root
2727
password: ""
28-
database: nextras
29-
28+
database: tests
29+
3030
orm:
3131
model: Tests\Mocks\Model\SimpleModel
32-
32+
3333
services:
3434
- Nette\Caching\Storages\DevNullStorage
3535
- Nette\Caching\Cache
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
<?php declare(strict_types = 1);
22

3-
namespace Tests\Cases\Integration;
4-
5-
/**
6-
* @Test: [integration] Books
7-
*/
3+
namespace Tests\Cases\E2E;
84

95
use Contributte\Nextras\Orm\QueryObject\Queryable;
106
use Contributte\Nextras\Orm\QueryObject\QueryObjectContextAwareManager;
117
use Contributte\Nextras\Orm\QueryObject\QueryObjectManager;
128
use Nette\DI\Container;
9+
use Nextras\Dbal\IConnection;
1310
use Nextras\Dbal\Result\Result;
11+
use Nextras\Dbal\Utils\FileImporter;
1412
use Nextras\Orm\Collection\ICollection;
1513
use Tester\Assert;
1614
use Tester\TestCase;
@@ -33,6 +31,13 @@ final class BooksTest extends TestCase
3331
$this->container = $container;
3432
}
3533

34+
protected function setUp(): void
35+
{
36+
/** @var IConnection $connection */
37+
$connection = $this->container->getByType(IConnection::class);
38+
FileImporter::executeFile($connection, __DIR__ . '/../../fixtures/mysql.sql');
39+
}
40+
3641
/**
3742
* Test empty results
3843
*/
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
<?php declare(strict_types = 1);
22

3-
/**
4-
* @Test: [unit] Contributte\Nextras\Orm\QueryObject\QueryObject
5-
*/
6-
73
use Nextras\Dbal\Drivers\Mysqli\MysqliDriver;
84
use Nextras\Dbal\QueryBuilder\QueryBuilder;
95
use Tester\Assert;
106
use Tests\Mocks\SimpleQueryObject;
117

12-
require_once __DIR__ . '/../../bootstrap.php';
8+
require_once __DIR__ . '/../bootstrap.php';
139

1410
test(function (): void {
1511
$qo = new SimpleQueryObject();

tests/cases/unit/QueryObjectExtension.phpt renamed to tests/cases/QueryObjectExtension.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
<?php declare(strict_types = 1);
22

3-
/**
4-
* @Test: [unit] Contributte\Nextras\Orm\QueryObject\DI\NextrasQueryObjectExtension
5-
*/
6-
73
use Contributte\Nextras\Orm\QueryObject\DI\NextrasQueryObjectExtension;
84
use Contributte\Nextras\Orm\QueryObject\QueryObjectManager;
95
use Nette\DI\Compiler;
106
use Nette\DI\Container;
117
use Nette\DI\ContainerLoader;
128
use Tester\Assert;
139

14-
require_once __DIR__ . '/../../bootstrap.php';
10+
require_once __DIR__ . '/../bootstrap.php';
1511

1612
test(function (): void {
1713
$loader = new ContainerLoader(TEMP_DIR);

0 commit comments

Comments
 (0)