Пример #1
0
 /**
  * @dataProvider provideChangedOptions
  */
 public function testIsOptionsChanged($oldOptions, $newOptions)
 {
     $invoker = new \stdClass();
     $mutableEventArgs = new MutableEventArgs($invoker, [], $oldOptions);
     $this->assertFalse($mutableEventArgs->isOptionsChanged());
     $this->assertSame($oldOptions, $mutableEventArgs->getOptions());
     $mutableEventArgs->setOptions($oldOptions);
     $this->assertSame($oldOptions, $mutableEventArgs->getOptions());
     $this->assertFalse($mutableEventArgs->isOptionsChanged());
     $mutableEventArgs->setOptions($newOptions);
     $this->assertSame($newOptions, $mutableEventArgs->getOptions());
     $this->assertTrue($mutableEventArgs->isOptionsChanged());
     $mutableEventArgs->setOptions($newOptions);
     $this->assertSame($newOptions, $mutableEventArgs->getOptions());
     $this->assertTrue($mutableEventArgs->isOptionsChanged());
     $mutableEventArgs->setOptions($oldOptions);
     $this->assertSame($oldOptions, $mutableEventArgs->getOptions());
     $this->assertFalse($mutableEventArgs->isOptionsChanged());
 }
Пример #2
0
 public function testMutableEventArgs()
 {
     $invoker = new \stdClass();
     $data = array('ok' => 1);
     $options = array('w' => 1);
     $mutableEventArgs = new MutableEventArgs($invoker, $data, $options);
     $this->assertSame($invoker, $mutableEventArgs->getInvoker());
     $this->assertSame($data, $mutableEventArgs->getData());
     $this->assertSame($options, $mutableEventArgs->getOptions());
     $this->assertFalse($mutableEventArgs->isDataChanged());
 }