1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Yiisoft\ActiveRecord\Tests\Driver\Sqlite; |
6
|
|
|
|
7
|
|
|
use Yiisoft\ActiveRecord\ActiveQuery; |
8
|
|
|
use Yiisoft\ActiveRecord\Tests\Stubs\MagicActiveRecord\Beta; |
9
|
|
|
use Yiisoft\ActiveRecord\Tests\Stubs\MagicActiveRecord\Customer; |
10
|
|
|
use Yiisoft\ActiveRecord\Tests\Support\SqliteHelper; |
11
|
|
|
use Yiisoft\Db\Connection\ConnectionInterface; |
12
|
|
|
|
13
|
|
|
final class MagicActiveRecordTest extends \Yiisoft\ActiveRecord\Tests\MagicActiveRecordTest |
|
|
|
|
14
|
|
|
{ |
15
|
|
|
protected function createConnection(): ConnectionInterface |
16
|
|
|
{ |
17
|
|
|
return (new SqliteHelper())->createConnection(); |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
public function testExplicitPkOnAutoIncrement(): void |
21
|
|
|
{ |
22
|
|
|
$this->checkFixture($this->db(), 'customer', true); |
23
|
|
|
|
24
|
|
|
$customer = new Customer(); |
25
|
|
|
|
26
|
|
|
$customer->id = 1337; |
27
|
|
|
$customer->email = '[email protected]'; |
28
|
|
|
$customer->name = 'user1337'; |
29
|
|
|
$customer->address = 'address1337'; |
30
|
|
|
|
31
|
|
|
$this->assertTrue($customer->isNewRecord); |
|
|
|
|
32
|
|
|
$customer->save(); |
33
|
|
|
|
34
|
|
|
$this->assertEquals(1337, $customer->id); |
35
|
|
|
$this->assertFalse($customer->isNewRecord); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* {@see https://github.com/yiisoft/yii2/issues/15482} |
40
|
|
|
*/ |
41
|
|
|
public function testEagerLoadingUsingStringIdentifiers(): void |
42
|
|
|
{ |
43
|
|
|
$this->checkFixture($this->db(), 'beta'); |
44
|
|
|
|
45
|
|
|
$betaQuery = new ActiveQuery(Beta::class); |
46
|
|
|
|
47
|
|
|
$betas = $betaQuery->with('alpha')->all(); |
48
|
|
|
|
49
|
|
|
$this->assertNotEmpty($betas); |
50
|
|
|
|
51
|
|
|
$alphaIdentifiers = []; |
52
|
|
|
|
53
|
|
|
/** @var Beta[] $betas */ |
54
|
|
|
foreach ($betas as $beta) { |
55
|
|
|
$this->assertNotNull($beta->alpha); |
56
|
|
|
$this->assertEquals($beta->alpha_string_identifier, $beta->alpha->string_identifier); |
57
|
|
|
$alphaIdentifiers[] = $beta->alpha->string_identifier; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
$this->assertEquals(['1', '01', '001', '001', '2', '2b', '2b', '02'], $alphaIdentifiers); |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths