Skip to content

Commit 207228b

Browse files
committed
Add test stub
1 parent ab6629b commit 207228b

File tree

4 files changed

+53
-1
lines changed

4 files changed

+53
-1
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -779,4 +779,3 @@ Professional support, consulting as well as software development services are av
779779
https://www.cebe.cc/en/contact
780780

781781
Development of this library is sponsored by [cebe.:cloud: "Your Professional Deployment Platform"](https://cebe.cloud).
782-
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
return [
4+
'openApiPath' => '@specs/issue_fix/90_implement_belongs_to_relations_in_models/index.yaml',
5+
'generateUrls' => false,
6+
'generateModels' => true,
7+
'excludeModels' => [
8+
'Error',
9+
],
10+
'generateControllers' => false,
11+
'generateMigrations' => false,
12+
'generateModelFaker' => false, // `generateModels` must be `true` in order to use `generateModelFaker` as `true`
13+
];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
openapi: "3.0.0"
2+
info:
3+
version: 1.0.0
4+
title: \#90
5+
paths:
6+
/:
7+
get:
8+
responses:
9+
'200':
10+
description: The information
11+
12+
components:
13+
schemas:
14+
User:
15+
type: object
16+
properties:
17+
id:
18+
type: integer
19+
20+
Address:
21+
type: object
22+
properties:
23+
id:
24+
type: integer
25+
user:
26+
$ref: '#/components/schemas/User'

tests/unit/IssueFixTest.php

+14
Original file line numberDiff line numberDiff line change
@@ -1014,4 +1014,18 @@ public function test22BugRulesRequiredIsGeneratedBeforeDefault()
10141014
]);
10151015
$this->checkFiles($actualFiles, $expectedFiles);
10161016
}
1017+
1018+
// https://github.com/php-openapi/yii2-openapi/issues/90
1019+
public function test90ImplementBelongsToRelationsInModels()
1020+
{
1021+
$testFile = Yii::getAlias("@specs/issue_fix/90_implement_belongs_to_relations_in_models/index.php");
1022+
$this->runGenerator($testFile);
1023+
$actualFiles = FileHelper::findFiles(Yii::getAlias('@app'), [
1024+
'recursive' => true,
1025+
]);
1026+
$expectedFiles = FileHelper::findFiles(Yii::getAlias("@specs/issue_fix/90_implement_belongs_to_relations_in_models/mysql"), [
1027+
'recursive' => true,
1028+
]);
1029+
$this->checkFiles($actualFiles, $expectedFiles);
1030+
}
10171031
}

0 commit comments

Comments
 (0)