assertSame( false, $var ); $this->assertSame( false, $var, 'Message' ); $this->assertSame( 2, $var ); $this->assertEquals( 2, $var, 'Message' ); $this->assertSame( 'Foo', $var ); $this->assertEquals( 'Foo', $var, 'Message' ); $this->assertSame( 246, $var * 2 ); $this->assertSame( 'Foo', $obj->method() ); $this->assertSame( 'Foo', $obj->method2()->toString() ); $this->assertSame( 'Foo', $arr['key'] ); $this->assertSame( 'bar', $obj->method2() ->method3() ->toString() ); // Variables named $expected* are assumed to be the expected value $expected = true; $this->assertSame( $expected, $var ); $this->assertEquals( $expected, $var, 'Message' ); $expectedResult = true; $this->assertSame( $expectedResult, $var ); $this->assertEquals( $expectedResult, $var, 'Message' ); // Not just a variable and a literal $this->assertSame( 'abc', wfFunctionCall( true ) ); $this->assertSame( 'xyz', wfFunctionCall( false )->bar() ); $this->assertSame( 246 * 2, $var ); $this->assertSame( SomeClass::SOME_CONST, $var ); // Actual value is an array with no variables/functions (except $expected*), // should be the actual $this->assertSame( [], $emptyArray, 'Message' ); $this->assertSame( [ 'something' => 'other' ], $result, 'Message' ); $this->assertSame( [ 'key' => $expectedValue ], $resultWithValue, 'Message' ); $this->assertSame( [ 1, 2, 3 ], $intArray, 'Message' ); $this->assertSame( [ 'first' => 'a', 'second' => $expected, 'nested' => [ true, false ], 500 ], $bigArray, 'Message' ); // Simple tests for the Not variants, there are handled the same $this->assertNotSame( 'NotSame', $var ); $this->assertNotEquals( 'NotEquals', $var ); // Should not be replaced $otherVariable = false; $this->assertSame( $var, $otherVariable ); $this->assertEquals( $var, $otherVariable, 'Message' ); $this->assertSame( $bigArray, [ 'first' => 'a', 'second' => $actual, 'nested' => [ true, false ], 500 ], 'Message' ); } }