質問編集履歴

1

使用していない処理と公開用に書き換えた部分で変数名にミスがあったので一部修正しました。

2021/09/09 13:18

投稿

hirata_fukuoka
hirata_fukuoka

スコア8

test CHANGED
File without changes
test CHANGED
@@ -34,18 +34,6 @@
34
34
 
35
35
  {
36
36
 
37
- // modelが返す値
38
-
39
- $tableData = [
40
-
41
- ['id' => 1],
42
-
43
- ['id' => 2],
44
-
45
- ];
46
-
47
-
48
-
49
37
  // Modelをmock
50
38
 
51
39
  $modelClassName = '\App\Models\Blog';
@@ -60,13 +48,13 @@
60
48
 
61
49
  $mockDb = \Mockery::mock($dbClass);
62
50
 
63
- $subQuery = $mockDb->shouldReceive('on')->times(1)->with('blogs.user_id', '=', 'users.id')->andReturnSelf();
51
+ $mockDb = $mockDb->shouldReceive('on')->times(1)->with('blogs.user_id', '=', 'users.id')->andReturnSelf();
64
52
 
65
- $subQuery = $mockDb->shouldReceive('whereNotNull')->times(1)->with('blogs.deleted_at')->andReturnSelf();
53
+ $mockDb = $mockDb->shouldReceive('whereNotNull')->times(1)->with('blogs.deleted_at')->andReturnSelf();
66
54
 
67
- $subQuery = $mockDb->shouldReceive('whereNotNull')->times(1)->with('users.deleted_at')->andReturnSelf();
55
+ $mockDb = $mockDb->shouldReceive('whereNotNull')->times(1)->with('users.deleted_at')->andReturnSelf();
68
56
 
69
- $join($subQuery);
57
+ $join($mockDb);
70
58
 
71
59
  return true;
72
60