Ejemplo n.º 1
0
 /**
  * Match the passed $uri and return an image ID on success
  *
  * @param string $uri
  * @return null|string Image ID
  */
 public function matchUri($uri)
 {
     $pattern = '#^' . preg_quote($this->options->getUriPath(), '#') . '/[0-9a-z]/[0-9a-z]/([0-9a-z]+)\\.[a-zA-Z]{3,4}$#';
     $matches = [];
     preg_match($pattern, $uri, $matches);
     return isset($matches[1]) ? $matches[1] : null;
 }
 /**
  * @covers ::getUriPath
  * @covers ::setUriPath
  */
 public function testUriPath()
 {
     $defaultUriPath = $this->options->getUriPath();
     $this->assertNotEmpty($defaultUriPath);
     $this->assertInternalType('string', $defaultUriPath);
     $value = '/someUri';
     $this->assertSame($this->options, $this->options->setUriPath($value));
     $this->assertEquals($value, $this->options->getUriPath());
 }
Ejemplo n.º 3
0
 /**
  * @param string $uri
  * @param string|null $expected
  * @covers ::matchUri
  * @dataProvider dataMatchUri
  */
 public function testMatchUri($uri, $expected)
 {
     $this->assertSame($expected, $this->manager->matchUri($this->options->getUriPath() . $uri));
 }