Example #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());
 }
 public function collectionPreRemove(MutableEventArgs $args)
 {
     $args->setData($this->query);
     $args->setOptions($this->options);
 }
 /**
  * @dataProvider provideChangedData
  */
 public function testIsDataChanged($oldData, $newData)
 {
     $invoker = new \stdClass();
     $mutableEventArgs = new MutableEventArgs($invoker, $oldData);
     $this->assertFalse($mutableEventArgs->isDataChanged());
     $this->assertSame($oldData, $mutableEventArgs->getData());
     $mutableEventArgs->setData($oldData);
     $this->assertSame($oldData, $mutableEventArgs->getData());
     $this->assertFalse($mutableEventArgs->isDataChanged());
     $mutableEventArgs->setData($newData);
     $this->assertSame($newData, $mutableEventArgs->getData());
     $this->assertTrue($mutableEventArgs->isDataChanged());
     $mutableEventArgs->setData($newData);
     $this->assertSame($newData, $mutableEventArgs->getData());
     $this->assertTrue($mutableEventArgs->isDataChanged());
     $mutableEventArgs->setData($oldData);
     $this->assertSame($oldData, $mutableEventArgs->getData());
     $this->assertFalse($mutableEventArgs->isDataChanged());
 }