質問編集履歴

4

エラー文の追加

2021/05/26 06:32

投稿

hello_space
hello_space

スコア24

test CHANGED
File without changes
test CHANGED
@@ -48,6 +48,16 @@
48
48
 
49
49
  このようなフォルダ階層になっている場合、SampleTestクラスの中でSample.php内のsamplefunctionをテストするにはどのようにすればテストが実行できますでしょうか?
50
50
 
51
- よろしくお願いしま
51
+ 現在はvendor/bin/phpunit tests/SampleTest.phpを実行ると
52
52
 
53
+ ```
54
+
53
- 実行自体はできており、vendor/bin/phpunit tests/SampleTest.phpで実行はできますが、samplefunctionをどのように読み込めばいいかがわかりません。
55
+ Error: Call to undefined function samplefunction()
56
+
57
+ ```
58
+
59
+ というエラーが発生します。
60
+
61
+ このsamplefunctionを読み込むことができれば実行できると思います。
62
+
63
+ よろしくお願いいたします。

3

説明の追加

2021/05/26 06:31

投稿

hello_space
hello_space

スコア24

test CHANGED
File without changes
test CHANGED
@@ -46,7 +46,7 @@
46
46
 
47
47
 
48
48
 
49
- このようなフォルダ階層になっている場合、SampleTestクラスの中でsamplefunctionをテストするにはどのようにすればテストが実行できますでしょうか?
49
+ このようなフォルダ階層になっている場合、SampleTestクラスの中でSample.php内のsamplefunctionをテストするにはどのようにすればテストが実行できますでしょうか?
50
50
 
51
51
  よろしくお願いします。
52
52
 

2

説明の追加

2021/05/24 03:12

投稿

hello_space
hello_space

スコア24

test CHANGED
File without changes
test CHANGED
@@ -28,13 +28,15 @@
28
28
 
29
29
  <?php
30
30
 
31
+ use PHPUnit\Framework\TestCase;
32
+
31
33
 
32
34
 
33
35
  class SampleTest extends Testcase {
34
36
 
35
37
  public function test1() {
36
38
 
37
- $this->assertEquals("", samplefunction());
39
+ $this->assertEquals("", samplefunction()); // Sample.php内のsamplefunctionを呼び出したい。
38
40
 
39
41
  }
40
42
 
@@ -47,3 +49,5 @@
47
49
  このようなフォルダ階層になっている場合、SampleTestクラスの中でsamplefunctionをテストするにはどのようにすればテストが実行できますでしょうか?
48
50
 
49
51
  よろしくお願いします。
52
+
53
+ 実行自体はできており、vendor/bin/phpunit tests/SampleTest.phpで実行はできますが、samplefunctionをどのように読み込めばいいかがわかりません。

1

説明の追加

2021/05/24 03:08

投稿

hello_space
hello_space

スコア24

test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,4 @@
1
- PHPUnitを使用しテストを書きたいと思っています。フレームワークはLumenを使用しています。
1
+ PHPUnitを使用しテストを書きたいと思っています。フレームワークはLaravel(Lumen)を使用しています。
2
2
 
3
3
  ```php
4
4