diff --git a/tests/Feature/Generator/ModelGeneratorTest.php b/tests/Feature/Generator/ModelGeneratorTest.php index 80c54b52..9d4b93aa 100644 --- a/tests/Feature/Generator/ModelGeneratorTest.php +++ b/tests/Feature/Generator/ModelGeneratorTest.php @@ -453,6 +453,7 @@ public function modelTreeDataProvider() ['drafts/nested-components.yaml', 'app/Admin/User.php', 'models/nested-components.php'], ['drafts/resource-statements.yaml', 'app/User.php', 'models/resource-statements.php'], ['drafts/all-column-types.yaml', 'app/AllType.php', 'models/all-column-types.php'], + ['drafts/alias-relationships.yaml', 'app/Salesman.php', 'models/alias-relationships.php'], ]; } diff --git a/tests/fixtures/drafts/alias-relationships.yaml b/tests/fixtures/drafts/alias-relationships.yaml new file mode 100644 index 00000000..373c1cab --- /dev/null +++ b/tests/fixtures/drafts/alias-relationships.yaml @@ -0,0 +1,7 @@ +models: + Salesman: + name: string + relationships: + hasOne: User:Lead + hasMany: class_name:method_name + belongsTo: class_name:method_name diff --git a/tests/fixtures/models/alias-relationships.php b/tests/fixtures/models/alias-relationships.php new file mode 100644 index 00000000..2f810720 --- /dev/null +++ b/tests/fixtures/models/alias-relationships.php @@ -0,0 +1,42 @@ + 'integer', + ]; + + + public function lead() + { + return $this->hasOne(\App\User::class); + } + + public function methodNames() + { + return $this->hasMany(\App\ClassName::class); + } + + public function methodName() + { + return $this->belongsTo(\App\ClassName::class); + } +}