use PHPUnit \Framework \TestCase ;
class AssertionsTest extends TestCase
{
public function test_assert_true ()
{
$ actual = false ;
$ this ->assertTrue ($ actual );
}
}
use PHPUnit \Framework \TestCase ;
class AssertionsTest extends TestCase
{
public function test_assert_false ()
{
$ actual = false ;
$ this ->assertFalse ($ actual );
}
}
use PHPUnit \Framework \TestCase ;
class AssertionsTest extends TestCase
{
public function test_assert_equals ()
{
$ expected = true ;
$ actual = true ;
$ this ->assertEquals ($ expected , $ actual );
}
}
use PHPUnit \Framework \TestCase ;
class AssertionsTest extends TestCase
{
public function test_assert_same ()
{
$ expected = true ;
$ actual = true ;
$ this ->assertSame ($ expected , $ actual );
}
}
use PHPUnit \Framework \TestCase ;
class AssertionsTest extends TestCase
{
public function test_assert_contains_array ()
{
$ needle = 3 ;
$ this ->assertContains ($ needle , [1 , 3 , 5 , 7 , 9 ]);
}
}
use PHPUnit \Framework \TestCase ;
class AssertionsTest extends TestCase
{
public function test_assert_contains_string ()
{
$ needle = 'oba ' ;
$ this ->assertContains ($ needle , 'foobar ' );
}
}
use PHPUnit \Framework \TestCase ;
class AssertionsTest extends TestCase
{
public function test_assert_count ()
{
$ this ->assertCount (5 , [1 , 3 , 5 , 7 , 9 ]);
}
}
use PHPUnit \Framework \TestCase ;
class AssertionsTest extends TestCase
{
public function test_assert_array_has_key ()
{
$ this ->assertArrayHasKey ('bar ' , ['bar ' => 'baz ' ]);
}
}
use PHPUnit \Framework \TestCase ;
class AssertionsTest extends TestCase
{
public function test_assert_array_subset ()
{
$ this ->assertArraySubset (['config ' => ['key-a ' ]], ['config ' => ['key-a ' , 'key-c ' ]]);
}
}
use PHPUnit \Framework \TestCase ;
class AssertionsTest extends TestCase
{
public function test_assert_internal_type ()
{
$ this ->assertInternalType ('numeric ' , 1 );
$ this ->assertInternalType ('numeric ' , 1.0 );
$ this ->assertInternalType ('int ' , 1 );
$ this ->assertInternalType ('float ' , 1.0 );
$ this ->assertInternalType ('string ' , '1 ' );
}
}
use PHPUnit \Framework \TestCase ;
class AssertionsTest extends TestCase
{
public function test_assert_instance_of ()
{
$ this ->assertInstanceOf (stdClass::class, new stdClass);
}
}
assertJsonStringEqualsJsonString
use PHPUnit \Framework \TestCase ;
class AssertionsTest extends TestCase
{
public function test_assert_json_string_equals_json_string ()
{
$ this ->assertJsonStringEqualsJsonString (
json_encode (['Mascot ' => 'Tux ' ]),
json_encode (['Mascot ' => 'Tux ' ])
);
}
}