Answer the question
In order to leave comments, you need to log in
How to not load fixtures for some tests from a suite in Yii2?
Testing the active record model:
class OrderTest extends DbTestCase
{
/** @var Order */
private $order;
public function setUp()
{
parent::setUp();
$this->order = new Order();
}
public function fixtures()
{
return [
'order' => OrderFixture::className(),
];
}
public function testGetPrice()
{
$this->order->price = 500;
$this->assertEquals(500, $this->order->getPrice());
}
public function testCanRetrieveAnOrderByItsId()
{
/** @var Order $order */
$order = Order::findOne(['id' => 1]);
$this->assertTrue($order instanceof Order);
$this->assertNotNull($order);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question