Example #1
0
 public function test_endsWith()
 {
     $com = F\endsWith('.com');
     $this->assertTrue($com('http://github.com'));
     $this->assertTrue(F\endsWith('the same', 'the same'));
     $this->assertFalse($com('php.net'));
     $this->assertFalse(F\endsWith('something very long', 'small thing'));
     $this->assertFalse(F\endsWith('something very long', 'very long'));
 }
Example #2
0
 function test_any()
 {
     $startsOrEndsWith = function ($text) {
         return F\any(F\startsWith($text), F\endsWith($text));
     };
     $test = $startsOrEndsWith('b');
     $alwaysFalse = F\any();
     $this->assertEquals(true, $test('bar'));
     $this->assertEquals(true, $test('bob'));
     $this->assertEquals(false, $test('foo'));
     $this->assertEquals(false, $alwaysFalse(1));
     $this->assertEquals(false, $alwaysFalse(null));
 }