Phactory\Mongo\PhactoryTest::testCreate PHP Method

testCreate() public method

public testCreate ( )
    public function testCreate()
    {
        $name = 'testuser';
        $tags = array('one', 'two', 'three');
        // define and create user in db
        $this->phactory->define('user', array('name' => $name, 'tags' => $tags));
        $user = $this->phactory->create('user');
        // test returned array
        $this->assertInternalType('array', $user);
        $this->assertEquals($user['name'], $name);
        $this->assertEquals($user['tags'], $tags);
        // retrieve and test expected document from database
        $db_user = $this->db->users->findOne();
        $this->assertEquals($name, $db_user['name']);
        $this->assertEquals($tags, $db_user['tags']);
    }