PHP code example of package-for-laravel / testing-framework
1. Go to this page and download the library: Download package-for-laravel/testing-framework library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
package-for-laravel / testing-framework example snippets
namespace Tests\Unit\Models;
use PackageForLaravel\TestingFramework\TestCases\UnitTestCase;
class UserTests extends UnitTestCase
{
public function testGetsFullName(): void
{
$this->todo();
}
public function testUserInfoShown(): void
{
$user = $this->createActingAs([
'name' => 'Guy Smiley'
]);
$this->get('/me')
->assertSee('Guy Smiley');
}
public function testDashboardRequiresUserAuth(): void
{
$this->noAuthRedirectTest(route('dashboard'));
}
public function testUpdateProfileRequiresAuth(): void
{
$this->noAuthRedirectTest(route('users.update'), 'PUT');
}
class Mine
{
protected function hiddenFunctionality(string $name): string
{
return $name . ' has secrets!';
}
}
public function testSecretsGeneratedProperly(): void
{
$mine = new Mine();
$this->assertEquals('aaron has secrets!', callMethod($mine, 'hiddenFunctionality', ['aaron']));
}
class Mine
{
protected $about = '';
public function __construct()
{
$this->about = 'me';
}
}
public function testItsAllAboutMe(): void
{
$mine = new Mine();
$this->assertEquals('me', getProperty($mine, 'about'));
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.