Turns out I was probably doing something wrong, but I was able to create a new factory for Cashier's Subscription class:
$factory->define(\Laravel\Cashier\Subscription::class, function(Faker\Generator $faker) {
static $user_id;
static $stripe_plan;
static $name;
static $stripe_id;
return [
'user_id' => $user_id,
'name' => $name ?: $faker->randomElement(['main']),
'stripe_id' => $stripe_id,
'stripe_plan' => $stripe_plan ?: $faker->randomElement(['plan-1', 'plan-2', 'plan-3']),
'quantity' => 1
];
});
Once I have a user created in my test, I grab its ID and create the subscription with factory():
$plan = factory(Subscription::class)->create([
'user_id' => $user->id,
'stripe_plan' => 'plan-1',
'stripe_id' => $token,
]);
Then, $user->subscribed('main', 'plan-1') is true.
Hopefully that helps someone else at some point,