PHP code example of codesleeve / fixture-l4
1. Go to this page and download the library: Download codesleeve/fixture-l4 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/ */
codesleeve / fixture-l4 example snippets
'Codesleeve\FixtureL4\FixtureL4ServiceProvider'
'Fixture' => 'Codesleeve\FixtureL4\Facades\Fixture',
return array (
'Travis' => array (
'first_name' => 'Travis',
'last_name' => 'Bennett',
'roles' => 'admin, endUser'
),
'Kelt' => array (
'first_name' => 'Kelt',
'last_name' => 'Dockins',
'roles' => 'endUser'
)
);
return array (
'admin' => array (
'name' => 'Admin'
),
'endUser' => array (
'name' => 'End User',
)
);
return array (
'Travis Profile' => array (
'user' => 'Travis',
'email' => '[email protected] ',
'state' => 'AR',
'country' => 'US',
'bio' => 'Travis bio information goes here.'
),
'Kelt Profile' => array (
'user' => 'Kelt',
'email' => '[email protected] ',
'state' => 'AR',
'country' => 'US',
'bio' =. 'Kelt bio information goes here.'
)
);
/**
* Creates the application.
*
* @return Symfony\Component\HttpKernel\HttpKernelInterface
*/
public function createApplication()
{
$unitTesting = true;
$testEnvironment = 'testing';
$start =
class ExampleTest extends TestCase {
public function setUp()
{
parent::setUp();
Fixture::up()
}
public function tearDown()
{
Fixture::down();
}
}
// Returns 'Bennett'
echo Fixture::users('Travis')->last_name;
// Returns 'AR'
echo Fixture::users('Kelt')->profile->state;
// Returns 'Admin'
echo Fixture::roles('admin')->name;