예제 #1
0
 public function testConcat2RightParametersNoChange()
 {
     $url = 'www.google.fr';
     $before = 'http://';
     $after = '/';
     $output = T::Concat($before, $after)->transform($url);
     $this->assertEquals($before . $url . $after, $output);
 }
 public function testNormalizeURLRightParametersChanges()
 {
     $urls = array('www.test.com/folder/file.html', 'test.com', 'www.example.com');
     foreach ($urls as $url) {
         $output = T::NormalizeURL('http')->transform($url);
         $this->assertEquals($output, 'http://' . $url);
     }
 }
 public function testReplaceRegexpRightParametersDoubleTransformation()
 {
     $str = 'ABABABABABAB';
     $output = T::ReplaceRegexp('/a/i', 'b')->ReplaceRegexp('/b/i', 'a')->transform($str);
     $this->assertEquals($output, preg_replace('/a|b/i', 'a', $str));
 }
 public function testImplodeRightParametersDoubleTransformation()
 {
     $input = array('ab', 'ab', 'ab', 'ab', 'ab', 'ab');
     $output = T::Implode('-')->Explode('-')->transform($input);
     $this->assertEquals($output, $input);
 }
 public function testCallbackSimpleFunctionMultipleArguments()
 {
     $str = 'ababab';
     $output = T::Callback('str_replace', 'a', 'b')->transform($str);
     $this->assertEquals($output, 'bbbbbb');
 }
 public function testTimezoneRightParametersDoubleTransformation()
 {
     $date = '2014-12-31 15:00:00';
     $output = T::Timezone('Y-m-d H:i:s', 'Pacific/Nauru', 'Asia/Calcutta')->Timezone('Y-m-d H:i:s', 'Asia/Calcutta', 'Pacific/Nauru')->transform($date);
     $this->assertEquals($output, $date);
 }
 public function testReplaceRightParametersDoubleTransformation()
 {
     $str = 'abababababab';
     $output = T::Replace('a', 'b')->Replace('b', 'a')->transform($str);
     $this->assertEquals($output, str_replace('b', 'a', $str));
 }
예제 #8
0
 /**
  * @expectedException Inet\Transformation\Exception\InvalidRuleException
  * @expectedExceptionMessageRegExp |The rule 'getFactory' does not exist|
  */
 public function testExistingStaticMethodAsRule()
 {
     T::getFactory();
 }
 public function testSlugifyRightParametersDoubleTransformation()
 {
     $output = T::Slugify()->Replace('o', 'a')->transform('Bonjour tôôut le monde !');
     $this->assertEquals($output, str_replace('o', 'a', 'bonjour-toout-le-monde'));
 }
예제 #10
0
 public function testDateRightParametersDoubleTransformation()
 {
     $date = '2015-01-01';
     $output = T::Date('Y-m-d', 'd-m-Y')->Date('d-m-Y', 'Y-m-d')->transform($date);
     $this->assertEquals($output, $date);
 }
예제 #11
0
 public function testExplodeRightParametersDoubleTransformation()
 {
     $str = 'ab-ab-ab-ab-ab-ab';
     $output = T::Explode('-')->Implode('-')->transform($str);
     $this->assertEquals($output, $str);
 }