Rectangle example


class RectangleTest extends TestCase {

  /** * Tests wrong rectangle width. * * @covers ::rotate */
  public function testWrongWidth() {
    $this->expectException(\InvalidArgumentException::class);
    $rect = new Rectangle(-40, 20);
  }

  /** * Tests wrong rectangle height. * * @covers ::rotate */
  public function testWrongHeight() {
    $this->expectException(\InvalidArgumentException::class);
    $rect = new Rectangle(40, 0);
  }

  

    return TRUE;
  }

  /** * {@inheritdoc} */
  public function transformDimensions(array &$dimensions$uri) {
    // If the rotate is not random and current dimensions are set,     // then the new dimensions can be determined.     if (!$this->configuration['random'] && $dimensions['width'] && $dimensions['height']) {
      $rect = new Rectangle($dimensions['width']$dimensions['height']);
      $rect = $rect->rotate($this->configuration['degrees']);
      $dimensions['width'] = $rect->getBoundingWidth();
      $dimensions['height'] = $rect->getBoundingHeight();
    }
    else {
      $dimensions['width'] = $dimensions['height'] = NULL;
    }
  }

  /** * {@inheritdoc} */
Home | Imprint | This part of the site doesn't use cookies.