Skip to content

Commit c174bc4

Browse files
committed
Add testing for "all tests failed"
1 parent 83ce4e1 commit c174bc4

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

tests/all-fail/HelloWorld.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
function helloWorld()
4+
{
5+
return "Goodbye, Mars!";
6+
}

tests/all-fail/HelloWorldTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
class HelloWorldTest extends PHPUnit\Framework\TestCase
6+
{
7+
public static function setUpBeforeClass(): void
8+
{
9+
require_once 'HelloWorld.php';
10+
}
11+
12+
public function testHelloWorldOne(): void
13+
{
14+
$this->assertEquals('Hello, World!', helloWorld());
15+
}
16+
17+
public function testHelloWorldTwo(): void
18+
{
19+
$this->assertEquals('Hello, World!', helloWorld());
20+
}
21+
22+
public function testHelloWorldThree(): void
23+
{
24+
$this->assertEquals('Hello, World!', helloWorld());
25+
}
26+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":3,"status":"fail","tests":[{"name":"Hello world one","status":"fail","test_code":"$this->assertEquals('Hello, World!', helloWorld());\n","message":"HelloWorldTest::testHelloWorldOne\nFailed asserting that two strings are equal.\n--- Expected\n+++ Actual\n@@ @@\n-'Hello, World!'\n+'Goodbye, Mars!'\n\nHelloWorldTest.php:14"},{"name":"Hello world two","status":"fail","test_code":"$this->assertEquals('Hello, World!', helloWorld());\n","message":"HelloWorldTest::testHelloWorldTwo\nFailed asserting that two strings are equal.\n--- Expected\n+++ Actual\n@@ @@\n-'Hello, World!'\n+'Goodbye, Mars!'\n\nHelloWorldTest.php:19"},{"name":"Hello world three","status":"fail","test_code":"$this->assertEquals('Hello, World!', helloWorld());\n","message":"HelloWorldTest::testHelloWorldThree\nFailed asserting that two strings are equal.\n--- Expected\n+++ Actual\n@@ @@\n-'Hello, World!'\n+'Goodbye, Mars!'\n\nHelloWorldTest.php:24"}]}

0 commit comments

Comments
 (0)