BasicPathTest.php in AmazonS3 7.2
File
tests/Matchable/BasicPathTest.php
View source
<?php
namespace Drupal\amazons3Test\Matchable;
use Drupal\amazons3\Matchable\BasicPath;
class BasicPathTest extends \PHPUnit_Framework_TestCase {
public function testFactory() {
$paths = BasicPath::factory(array(
'.*',
'.?',
));
$this
->assertTrue(is_array($paths));
foreach ($paths as $path) {
$this
->assertInstanceOf('Drupal\\amazons3\\Matchable\\BasicPath', $path);
}
$this
->assertEquals('.*', $paths[0]
->getPath());
$this
->assertEquals('.?', $paths[1]
->getPath());
}
public function testToString() {
$path = new BasicPath('.*');
$this
->assertEquals($path
->getPath(), (string) $path);
}
public function testInvalidPattern() {
new BasicPath('?');
}
public function testStarPattern() {
$path = new BasicPath('*');
$this
->assertSame($path, $path
->match('foo'));
}
public function testRegexMatching() {
$path = new BasicPath('^ab$');
$this
->assertSame($path, $path
->match('ab'));
$this
->assertFalse($path
->match('yz'));
}
}
Classes
Name |
Description |
BasicPathTest |
@class BasicPathTest
@package Drupal\amazons3Test\Matchable |