Ejemplo n.º 1
0
 public function test_with_fixture()
 {
     $this->setPostFixture(__DIR__ . '/fixture.yml');
     $post = SamplePlugin::get_new_post_with_uppercase();
     $this->assertEquals('TEST POST TITLE 4', $post->post_title);
     $this->assertEquals('TEST POST CONTENT 4', $post->post_content);
 }
Ejemplo n.º 2
0
 public function testUsePluginFunction()
 {
     SamplePlugin::register();
     $sum = 0;
     Ginq::range(1, 10)->eachEager(function ($v) use(&$sum) {
         $sum += $v;
     });
     $this->assertEquals(55, $sum);
     $group_count = 0;
     Ginq::range(1, 299)->groupBy(function ($x) {
         return floor($x / 100);
     })->eachEager(function ($gr, $k) use(&$group_count) {
         $group_count += 1;
     });
     $this->assertEquals(3, $group_count);
 }