-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
Class "com.example.App+xp.web.dev.Console" could not be found
- Loading branch information
Showing
4 changed files
with
70 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php namespace web\unittest; | ||
|
||
use web\Application; | ||
|
||
class HelloWorld extends Application { | ||
|
||
/** @return var */ | ||
public function routes() { | ||
return ['/' => function($req, $res) { | ||
$res->answer(200); | ||
$res->send('Hello World', 'text/plain'); | ||
}]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php namespace web\unittest; | ||
|
||
use io\Path; | ||
use lang\XPClass; | ||
use unittest\TestCase; | ||
use web\Environment; | ||
use xp\web\ServeDocumentRootStatically; | ||
use xp\web\Source; | ||
|
||
class SourceTest extends TestCase { | ||
private $environment; | ||
|
||
/** @return void */ | ||
public function setUp() { | ||
$this->environment= new Environment('dev', '.', 'static', []); | ||
} | ||
|
||
#[@test] | ||
public function serve_document_root() { | ||
$src= new Source('-', $this->environment); | ||
$this->assertInstanceOf(ServeDocumentRootStatically::class, $src->application()); | ||
} | ||
|
||
#[@test] | ||
public function application_class() { | ||
$src= new Source('web.unittest.HelloWorld', $this->environment); | ||
$this->assertInstanceOf(HelloWorld::class, $src->application()); | ||
} | ||
|
||
#[@test] | ||
public function application_file() { | ||
$base= XPClass::forName('web.unittest.HelloWorld')->getClassLoader()->path; | ||
$src= new Source(new Path($base, 'web/unittest/HelloWorld.class.php'), $this->environment); | ||
$this->assertInstanceOf(HelloWorld::class, $src->application()); | ||
} | ||
|
||
#[@test] | ||
public function application_class_and_filter() { | ||
$src= new Source('web.unittest.HelloWorld+xp.web.dev.Console', $this->environment); | ||
$this->assertInstanceOf(HelloWorld::class, $src->application()); | ||
} | ||
} |