For example, in the database there is a table tbl_identitydocument, which is not linked with others:
CREATE TABLE [dbo].[tbl_identitydocument]( [ID] [int] IDENTITY(1,1) NOT NULL, [Name] [varchar](100) NOT NULL, [FISID] [int] NULL, CONSTRAINT [PK_tbl_identitydocument] PRIMARY KEY CLUSTERED ( [ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY]
This table corresponds to the model IdentityDocument.php. In the model there is the validation of the fields, for it is written a simple Unit test.
The test fails with the error:
There was 1 error: [yii\base\InvalidParamException] Table not found: 
How to test models in Yii 2? Maybe I’m doing something wrong. And for the test, and for the Web application I use the same database.