/**
  * @test
  * @covers Cocur\Slugify\Slugify::activateRuleset()
  */
 public function activateRulesetActivatesTheGivenRuleset()
 {
     $provider = Mockery::mock('\\Cocur\\Slugify\\RuleProvider\\RuleProviderInterface');
     $provider->shouldReceive('getRules')->with('esperanto')->once()->andReturn(['ĉ' => 'cx']);
     $slugify = new Slugify(['rulesets' => []], $provider);
     $this->assertInstanceOf('Cocur\\Slugify\\Slugify', $slugify->activateRuleset('esperanto'));
     $this->assertEquals('sercxi', $slugify->slugify('serĉi'));
 }
Esempio n. 2
0
 /**
  * Activates an additional ruleset.
  *
  * @param string $name Name of the ruleset.
  * @return \Cocur\Slugify\Slugify 
  * @throws \InvalidArgumentException if the no ruleset with the given name exists
  * @static 
  */
 public static function activateRuleset($name)
 {
     return \Cocur\Slugify\Slugify::activateRuleset($name);
 }