×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Dmitriy Lanets
Added: Apr 22, 2015 12:15 PM
Views: 18
Tags: phpunit
  1. $reflectionClass = new \ReflectionClass($this->object);//создаем reflectionClass
  2. $r = $reflectionClass->getProperty('text');//получаем свойство
  3. $r->setAccessible(true);//делаем открытым
  4. $r->setValue($this->object,'bla bla');//изменяем значение
  5. $this->assertEquals('bla bla',$this->object->GetText());//тестируем метод