Example #1
0
 function testCallback()
 {
     $error = $success = $send = false;
     Api::onError(function ($message) use(&$error) {
         $error = true;
         var_dump($message);
     });
     Api::onSuccess(function () use(&$success) {
         $success = true;
     });
     Api::onSend(function ($url) use(&$send) {
         $send = true;
         printf('fetch [%s]' . PHP_EOL, $url);
     });
     $this->assertNull(Api::wot()->qwe->qwe());
     $this->assertNotNull(Api::wot()->encyclopedia->tanks());
     $this->assertNotNull(Api::getMeta());
     $this->assertTrue($error);
     $this->assertTrue($success);
     $this->assertTrue($send);
 }