diff --git a/tests/Facade/FactoryMuffinTest.php b/tests/Facade/FactoryMuffinTest.php new file mode 100644 index 0000000..7b90e3c --- /dev/null +++ b/tests/Facade/FactoryMuffinTest.php @@ -0,0 +1,61 @@ + 'string', + 'active' => 'boolean', + 'email' => 'email' + )); + + $user = FactoryMuffin::create('\League\FactoryMuffin\Test\Facade\User'); + + $this->assertInternalType('string', $user->name); + $this->assertInternalType('boolean', $user->active); + $this->assertContains('@', $user->email); + } + + public function testInstance() + { + FactoryMuffin::define('\League\FactoryMuffin\Test\Facade\User', array( + 'name' => 'string', + 'active' => 'boolean', + 'email' => 'email' + )); + + $user = FactoryMuffin::instance('\League\FactoryMuffin\Test\Facade\User'); + + $this->assertInternalType('string', $user->name); + $this->assertInternalType('boolean', $user->active); + $this->assertContains('@', $user->email); + } + + public function testAttributesFor() + { + FactoryMuffin::define('\League\FactoryMuffin\Test\Facade\User', array( + 'name' => 'string', + 'active' => 'boolean', + 'email' => 'email' + )); + + $attributes = FactoryMuffin::attributesFor('\League\FactoryMuffin\Test\Facade\User'); + + $this->assertInternalType('string', $attributes['name']); + $this->assertInternalType('boolean', $attributes['active']); + $this->assertContains('@', $attributes['email']); + } +} + +class User +{ + public function save() + { + return true; + } +}