Exemple #1
0
 public function testSlugize()
 {
     $this->assertEquals('foo-bar', Slugize::slugize('foo bar'));
     $this->assertEquals('foo-bar', Slugize::slugize('FOO BAR'));
     $this->assertEquals('foobar', Slugize::slugize('/foo/bar/'));
     $this->assertEquals('foobar', Slugize::slugize('foo!bar'));
     $this->assertEquals('foo-bar', Slugize::slugize('foo@bar'));
     $this->assertEquals('foo-bar', Slugize::slugize('foo#bar'));
     $this->assertEquals('foo-bar', Slugize::slugize('foo$bar'));
     $this->assertEquals('foo-bar', Slugize::slugize('foo%bar'));
     $this->assertEquals('foo-bar', Slugize::slugize('foo^bar'));
     $this->assertEquals('foo-bar', Slugize::slugize('foo&bar'));
     $this->assertEquals('foo-bar', Slugize::slugize('foo*bar'));
     $this->assertEquals('foo-bar', Slugize::slugize('foo(bar'));
     $this->assertEquals('foo-bar', Slugize::slugize('foo)bar'));
     $this->assertEquals('foo-bar', Slugize::slugize('foo{bar'));
     $this->assertEquals('foo-bar', Slugize::slugize('foo}bar'));
     $this->assertEquals('foobar', Slugize::slugize('foo:bar'));
     $this->assertEquals('foo-bar', Slugize::slugize('foo"bar'));
     $this->assertEquals('foo-bar', Slugize::slugize('foo+bar'));
     $this->assertEquals('foo-bar', Slugize::slugize('foo-bar'));
     $this->assertEquals('lueckenbuesser', Slugize::slugize('Lückenbüßer'));
     $this->assertEquals('-bergroesse', Slugize::slugize('Übergröße'));
     $this->assertEquals('ausserplanmaessig', Slugize::slugize('außerplanmäßig'));
     $this->assertEquals('vaelkommen', Slugize::slugize('välkommen!'));
 }
Exemple #2
0
 public function generateKey(FileInterface $file = null)
 {
     return date('Y/m/') . Slugize::slugize($file->getLabel()) . '.' . $file->getExtension();
 }