Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example code doesn't work #2

Open
aydot opened this issue May 17, 2015 · 1 comment
Open

Example code doesn't work #2

aydot opened this issue May 17, 2015 · 1 comment

Comments

@aydot
Copy link

aydot commented May 17, 2015

public function setUp()
{
    $this->FeedFactory = new \App\Test\Factory\PostFactory();
}

public function testSomething()
{
    $post = $this->FeedFactory(1); // create a single record
    $this->assertTrue(isset($post->id));

    $this->FeedFactory(10); // create 10 records
}

fails with PHP Fatal error: Call to undefined method...

However, if I assign the "class variable" into a local variable like so:

public function testSomething()
{
    $post = $this->FeedFactory; // create a single record
    $post(1); 
    $this->assertTrue(isset($post->id));

    $post(10); // create 10 records
}

it works

@aydot
Copy link
Author

aydot commented May 19, 2015

do you plan on implementing relationships?

public $user_id = 'factory|App\Model\Entity\User';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant