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

unit тесты #19

Open
des1roer opened this issue Mar 24, 2016 · 1 comment
Open

unit тесты #19

des1roer opened this issue Mar 24, 2016 · 1 comment
Labels

Comments

@des1roer
Copy link

можете показать пример написания unit теста с проверкой загрузки данных в таблицу?

@githubjeka
Copy link
Owner

namespace tests\codeception\common\unit;
use tests\codeception\common\fixtures\TemperatureFixture;

class AssortmentTest extends tests\codeception\common\unit\TestCase
{
    public function fixtures()
    {
        return [
            TemperatureFixture::className(),
        ];
    }

    public function testTryCreateModel()
    {    
        // Получаем массив значений из бд  
        $temperaturesFromDataBase = $this->getFixture(TemperatureFixture::className())->data;

        // ... проверки
    }
}
namespace tests\codeception\common\fixtures;

class TemperatureFixture extends yii\test\ActiveFixture
{
    public $modelClass = 'common\models\Temperature';
}

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

No branches or pull requests

2 participants