コード例 #1
0
 /**
  * @param array $params
  * @param array $expectedParams
  *
  * @dataProvider paramsDataProvider
  */
 public function testRouteParameters($params, array $expectedParams)
 {
     $map = [];
     foreach ($params as $name => $value) {
         $map[] = [$name, null, $value];
     }
     $this->route->expects($this->any())->method('getMatchedParam')->willReturnMap($map);
     $this->haikunator->expects($this->atLeastOnce())->method('__invoke')->with($expectedParams);
     $this->command->__invoke($this->route, $this->console);
 }
コード例 #2
0
 public function testEverythingInOne()
 {
     Haikunator::$ADJECTIVES = ['green'];
     Haikunator::$NOUNS = ['reindeer'];
     $haikunate = Haikunator::haikunate(["delimiter" => ".", "tokenLength" => 8, "tokenChars" => "l"]);
     $this->assertRegExp("/(green)(\\.)(reindeer)(\\.)(llllllll)\$/i", $haikunate);
 }
コード例 #3
0
 /**
  * @param Route $route
  */
 protected function setAdjectivesFromRoute(Route $route)
 {
     $adjectives = $route->getMatchedParam('adjectives');
     if (!empty($adjectives)) {
         Haikunator::$ADJECTIVES = $this->getValuesFromFileIfExists($adjectives);
     }
 }
コード例 #4
0
 public function testCanBeUsedAsCallable()
 {
     Haikunator::$ADJECTIVES = ['green'];
     Haikunator::$NOUNS = ['reindeer'];
     $haikunator = new Haikunator();
     $this->assertTrue(is_callable($haikunator));
     $params = ['tokenLength' => 0];
     $this->assertSame($haikunator($params), Haikunator::haikunate($params));
 }