Skip to content

Commit

Permalink
Remove "tests" path
Browse files Browse the repository at this point in the history
  • Loading branch information
staudenmeir committed Sep 23, 2024
1 parent 053a766 commit d63699f
Show file tree
Hide file tree
Showing 22 changed files with 1 addition and 293 deletions.
3 changes: 0 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
"larastan/larastan": "^2.9",
"mockery/mockery": "^1.6",
"orchestra/testbench": "^9.0",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-mockery": "^1.1",
"phpstan/phpstan-phpunit": "^1.4",
"phpunit/phpunit": "^11.0",
"staudenmeir/eloquent-json-relations": "^1.11",
"staudenmeir/laravel-adjacency-list": "^1.21"
Expand Down
4 changes: 0 additions & 4 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
includes:
- ./vendor/larastan/larastan/extension.neon
- ./vendor/phpstan/phpstan-mockery/extension.neon
- ./vendor/phpstan/phpstan-phpunit/extension.neon
- ./vendor/phpstan/phpstan-phpunit/rules.neon
parameters:
level: 6
paths:
- src
- tests
treatPhpDocTypesAsCertain: false
ignoreErrors:
- '#Unsafe usage of new static\(\).#'
9 changes: 0 additions & 9 deletions tests/Concatenation/EloquentJsonRelations/Models/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,10 @@
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
use Staudenmeir\EloquentJsonRelations\JsonKey;

/**
* @property-read \Illuminate\Database\Eloquent\Relations\Pivot $pivot
*/
class Project extends Model
{
use HasRelationships;

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\EloquentJsonRelations\Models\Role, $this>
*/
public function roles(): HasManyDeep
{
return $this->hasManyThroughJson(
Expand All @@ -28,9 +22,6 @@ public function roles(): HasManyDeep
);
}

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\EloquentJsonRelations\Models\Role, $this>
*/
public function roles2(): HasManyDeep
{
return $this->hasManyThroughJson(
Expand Down
12 changes: 0 additions & 12 deletions tests/Concatenation/EloquentJsonRelations/Models/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,20 @@
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
use Staudenmeir\EloquentJsonRelations\JsonKey;

/**
* @property-read \Illuminate\Database\Eloquent\Relations\Pivot $pivot
*/
class Role extends Model
{
use HasRelationships;

/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Tests\Concatenation\EloquentJsonRelations\Models\Permission>
*/
public function permissions(): HasMany
{
return $this->hasMany(Permission::class);
}

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\EloquentJsonRelations\Models\Project, $this>
*/
public function projects(): HasManyDeep
{
return $this->hasManyThroughJson(Project::class, User::class, new JsonKey('options->role_ids'));
}

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\EloquentJsonRelations\Models\Project, $this>
*/
public function projects2(): HasManyDeep
{
return $this->hasManyThroughJson(Project::class, User::class, new JsonKey('options->roles[]->role->id'));
Expand Down
6 changes: 0 additions & 6 deletions tests/Concatenation/EloquentJsonRelations/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,11 @@ class User extends Model
'options' => 'json',
];

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\EloquentJsonRelations\Models\Permission, $this>
*/
public function permissions(): HasManyDeep
{
return $this->hasManyDeepFromRelations($this->roles(), (new Role())->permissions());
}

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\EloquentJsonRelations\Models\Permission, $this>
*/
public function permissions2(): HasManyDeep
{
return $this->hasManyDeepFromRelations($this->roles2(), (new Role())->permissions());
Expand Down
28 changes: 0 additions & 28 deletions tests/Concatenation/LaravelAdjacencyList/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,13 @@
use Staudenmeir\LaravelAdjacencyList\Eloquent\HasRecursiveRelationships;
use Staudenmeir\LaravelAdjacencyList\Eloquent\Relations\HasManyOfDescendants;

/**
* @property-read \Tests\Concatenation\LaravelAdjacencyList\Models\Post $ancestorPost
* @property-read \Tests\Concatenation\LaravelAdjacencyList\Models\Post $descendantPost
*/
class User extends Model
{
use HasRelationships;
use HasRecursiveRelationships;
use HasTableAlias;
use SoftDeletes;

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasOneDeep<\Tests\Concatenation\LaravelAdjacencyList\Models\Post, $this>
*/
public function ancestorPost(): HasOneDeep
{
return $this->hasOneDeepFromRelations(
Expand All @@ -33,9 +26,6 @@ public function ancestorPost(): HasOneDeep
);
}

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\LaravelAdjacencyList\Models\Post, $this>
*/
public function ancestorPosts(): HasManyDeep
{
return $this->hasManyDeepFromRelations(
Expand All @@ -44,9 +34,6 @@ public function ancestorPosts(): HasManyDeep
);
}

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\LaravelAdjacencyList\Models\Post, $this>
*/
public function ancestorAndSelfPosts(): HasManyDeep
{
return $this->hasManyDeepFromRelations(
Expand All @@ -55,9 +42,6 @@ public function ancestorAndSelfPosts(): HasManyDeep
);
}

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\LaravelAdjacencyList\Models\Post, $this>
*/
public function bloodlinePosts(): HasManyDeep
{
return $this->hasManyDeepFromRelations(
Expand All @@ -66,9 +50,6 @@ public function bloodlinePosts(): HasManyDeep
);
}

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasOneDeep<\Tests\Concatenation\LaravelAdjacencyList\Models\Post, $this>
*/
public function descendantPost(): HasOneDeep
{
return $this->hasOneDeepFromRelations(
Expand All @@ -77,9 +58,6 @@ public function descendantPost(): HasOneDeep
);
}

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\LaravelAdjacencyList\Models\Post, $this>
*/
public function descendantPosts(): HasManyDeep
{
return $this->hasManyDeepFromRelations(
Expand All @@ -88,9 +66,6 @@ public function descendantPosts(): HasManyDeep
);
}

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\LaravelAdjacencyList\Models\Post, $this>
*/
public function descendantPostsAndSelf(): HasManyDeep
{
return $this->hasManyDeepFromRelations(
Expand All @@ -99,9 +74,6 @@ public function descendantPostsAndSelf(): HasManyDeep
);
}

/**
* @return \Staudenmeir\LaravelAdjacencyList\Eloquent\Relations\HasManyOfDescendants<\Tests\Concatenation\LaravelAdjacencyList\Models\Post>
*/
public function posts(): HasManyOfDescendants
{
return $this->hasManyOfDescendants(Post::class);
Expand Down
9 changes: 0 additions & 9 deletions tests/Concatenation/LaravelHasManyMerged/Models/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ class Country extends Model
{
use HasRelationships;

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\LaravelHasManyMerged\Models\Attachment, $this>
*/
public function attachments(): HasManyDeep
{
return $this->hasManyDeepFromRelations(
Expand All @@ -23,17 +20,11 @@ public function attachments(): HasManyDeep
);
}

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\LaravelHasManyMerged\Models\Message, $this>
*/
public function messages(): HasManyDeep
{
return $this->hasManyDeepFromRelations($this->users(), (new User())->messages());
}

/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Tests\Concatenation\LaravelHasManyMerged\Models\User>
*/
public function users(): HasMany
{
return $this->hasMany(User::class);
Expand Down
3 changes: 0 additions & 3 deletions tests/Concatenation/LaravelHasManyMerged/Models/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@

class Message extends Model
{
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Tests\Concatenation\LaravelHasManyMerged\Models\Attachment>
*/
public function attachments(): HasMany
{
return $this->hasMany(Attachment::class);
Expand Down
6 changes: 0 additions & 6 deletions tests/Concatenation/LaravelHasManyMerged/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,11 @@ class User extends Model
use HasManyMergedRelation;
use HasRelationships;

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\LaravelHasManyMerged\Models\Attachment, $this>
*/
public function attachments(): HasManyDeep
{
return $this->hasManyDeepFromRelations($this->messages(), (new Message())->attachments());
}

/**
* @return \Korridor\LaravelHasManyMerged\HasManyMerged<\Tests\Concatenation\LaravelHasManyMerged\Models\Message>
*/
public function messages(): HasManyMerged
{
return $this->hasManyMerged(Message::class, ['sender_id', 'recipient_id']);
Expand Down
2 changes: 0 additions & 2 deletions tests/HasManyDeepTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ public function testExistenceQueryForThroughSelfRelationWithoutAliasTrait(): voi

public function testWithTrashed(): void
{
/** @var \Tests\Models\User $user */
$user = Comment::find(33)->user()
->withTrashed()
->first();
Expand All @@ -182,7 +181,6 @@ public function testWithTrashedIntermediateAndWithCount(): void
{
$country = Country::withCount('commentsWithTrashedUsers as count')->first();

// @phpstan-ignore property.notFound
$this->assertEquals(3, $country->count);
}
}
6 changes: 0 additions & 6 deletions tests/IdeHelper/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,11 @@ class User extends Model
{
use HasRelationships;

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasOneDeep<\Tests\IdeHelper\Models\Comment, $this>
*/
public function comment(): HasOneDeep
{
return $this->hasOneDeep(Comment::class, [Post::class]);
}

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\IdeHelper\Models\Comment, $this>
*/
public function comments(): HasManyDeep
{
return $this->hasManyDeep(Comment::class, [Post::class]);
Expand Down
24 changes: 0 additions & 24 deletions tests/Models/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,68 +8,44 @@
use Staudenmeir\EloquentHasManyDeep\HasOneDeep;
use Staudenmeir\EloquentHasManyDeep\HasTableAlias;

/**
* @property-read \Tests\Models\Country|null $country
* @property-read \Tests\Models\Country|null $countryWithCustomThroughTable
* @property-read \Tests\Models\Post|null $post
* @property-read \Tests\Models\Post|null $rootPost
*/
class Comment extends Model
{
use HasTableAlias;
use SoftDeletes;

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasOneDeep<\Tests\Models\Country, $this>
*/
public function country(): HasOneDeep
{
return $this->hasOneDeepFromReverse(
(new Country())->commentsFromRelations()
);
}

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasOneDeep<\Tests\Models\Country, $this>
*/
public function countryWithCustomThroughTable(): HasOneDeep
{
return $this->hasOneDeepFromReverse(
(new Country())->commentsFromRelationsWithCustomThroughTable()
);
}

/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Tests\Models\Comment>
*/
public function replies(): HasMany
{
return $this->hasMany(Comment::class, 'parent_id');
}

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasOneDeep<\Tests\Models\Post, $this>
*/
public function rootPost(): HasOneDeep
{
return $this->hasOneDeepFromReverse(
(new Post())->nestedCommentReplies()
);
}

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Tag, $this>
*/
public function tags(): HasManyDeep
{
return $this->hasManyDeepFromReverse(
(new Tag())->comments()
);
}

/**
* @return \Staudenmeir\EloquentHasManyDeep\HasOneDeep<\Tests\Models\User, $this>
*/
public function user(): HasOneDeep
{
return $this->hasOneDeep(
Expand Down
Loading

0 comments on commit d63699f

Please sign in to comment.