コード例 #1
0
 /**
  * @covers ::into
  * @dataProvider provideNonIndexableNorAssignable
  */
 public function testOursMustBeIndexableOrAssignable($ours)
 {
     // ----------------------------------------------------------------
     // setup your test
     $theirs = [];
     // ----------------------------------------------------------------
     // perform the change
     $actualResult = AreMergeable::into($ours, $theirs);
     // ----------------------------------------------------------------
     // test the results
     $this->assertFalse($actualResult);
 }
コード例 #2
0
 /**
  * should we overwrite $ours[$key] with the value of $theirs?
  *
  * @param  array $ours
  *         the array where $key may exist
  * @param  string $key
  *         the index on $ours whose fate we are deciding
  * @param  mixed $theirs
  *         the data we want to assign to the index
  * @return boolean
  *         TRUE if we should overwrite the index's existing value
  *         with $value
  *         TRUE if $key currently has no value
  *         FALSE if we should merge $value into the index's exist
  *         value
  */
 private static function checkArray(array $ours, $key, $theirs)
 {
     // special case - index does not exist
     if (!array_key_exists($key, $ours)) {
         return true;
     }
     // general case - index exists, and we need to decide what should
     // be done about it
     return !AreMergeable::into($ours[$key], $theirs);
 }