1. Go to this page and download the library: Download foothing/laravel-fixture 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/ */
foothing / laravel-fixture example snippets
public function tearDown() {
// Your code
// ...
Fixture::tearDown();
}
class FooTest {
public function testBar() {
// Create your fixture by passing the namespaced class name
// you want to fixture and an array of attributes.
// If an User instance matching the given attributes is found,
// then it will be returned. Otherwise a new User instance will be
// saved to the testing database.
// Note that User must be an Eloquent implementation.
$user = Fixture::need('User', array('email' => 'email1'));
// Example, $user now exists with the given attributes.
$this->assertEquals($user->email, 'email1');
// ...
// more tests.
}
}
class FooTest {
public function testBar() {
// Ensure that no instances of Some\Object matching the given
// attributes are stored in the testing database.
Fixture::needNot('Some\Object', array('attribute' => 'value'));
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.