1<?php
2class FailureTest extends PHPUnit_Framework_TestCase
3{
4    public function testAssertArrayEqualsArray()
5    {
6        $this->assertEquals([1], [2], 'message');
7    }
8
9    public function testAssertIntegerEqualsInteger()
10    {
11        $this->assertEquals(1, 2, 'message');
12    }
13
14    public function testAssertObjectEqualsObject()
15    {
16        $a      = new StdClass;
17        $a->foo = 'bar';
18
19        $b      = new StdClass;
20        $b->bar = 'foo';
21
22        $this->assertEquals($a, $b, 'message');
23    }
24
25    public function testAssertNullEqualsString()
26    {
27        $this->assertEquals(null, 'bar', 'message');
28    }
29
30    public function testAssertStringEqualsString()
31    {
32        $this->assertEquals('foo', 'bar', 'message');
33    }
34
35    public function testAssertTextEqualsText()
36    {
37        $this->assertEquals("foo\nbar\n", "foo\nbaz\n", 'message');
38    }
39
40    public function testAssertStringMatchesFormat()
41    {
42        $this->assertStringMatchesFormat('*%s*', '**', 'message');
43    }
44
45    public function testAssertNumericEqualsNumeric()
46    {
47        $this->assertEquals(1, 2, 'message');
48    }
49
50    public function testAssertTextSameText()
51    {
52        $this->assertSame('foo', 'bar', 'message');
53    }
54
55    public function testAssertObjectSameObject()
56    {
57        $this->assertSame(new StdClass, new StdClass, 'message');
58    }
59
60    public function testAssertObjectSameNull()
61    {
62        $this->assertSame(new StdClass, null, 'message');
63    }
64
65    public function testAssertFloatSameFloat()
66    {
67        $this->assertSame(1.0, 1.5, 'message');
68    }
69
70    // Note that due to the implementation of this assertion it counts as 2 asserts
71    public function testAssertStringMatchesFormatFile()
72    {
73        $this->assertStringMatchesFormatFile(__DIR__ . '/expectedFileFormat.txt', '...BAR...');
74    }
75}
76