-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bugs after composite the web app
- Loading branch information
1 parent
14bdaaa
commit 4d63130
Showing
9 changed files
with
191 additions
and
19 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,46 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Knowledge Base package. | ||
* | ||
* Copyright (c) 2015 LIN3S <info@lin3s.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace spec\LIN3S\KnowledgeBase\Loader; | ||
|
||
use LIN3S\KnowledgeBase\Configuration; | ||
use PhpSpec\ObjectBehavior; | ||
use Prophecy\Argument; | ||
|
||
/** | ||
* Spec class of menu loader. | ||
* | ||
* @author Beñat Espiña <benatespina@gmail.com> | ||
*/ | ||
class MenuLoaderSpec extends ObjectBehavior | ||
{ | ||
function let(Configuration $configuration) | ||
{ | ||
$configuration->buildPath()->willReturn(__DIR__ . '/../fixtures/'); | ||
|
||
$this->beConstructedWith($configuration); | ||
} | ||
|
||
function it_is_initializable() | ||
{ | ||
$this->shouldHaveType('LIN3S\KnowledgeBase\Loader\MenuLoader'); | ||
} | ||
|
||
function it_implements_loader_interface() | ||
{ | ||
$this->shouldImplement('LIN3S\KnowledgeBase\Loader\Interfaces\LoaderInterface'); | ||
} | ||
|
||
function it_get() | ||
{ | ||
$this->get('build'); | ||
} | ||
} |
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,57 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Knowledge Base package. | ||
* | ||
* Copyright (c) 2015 LIN3S <info@lin3s.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace LIN3S\KnowledgeBase\Loader; | ||
|
||
use LIN3S\KnowledgeBase\Configuration; | ||
use LIN3S\KnowledgeBase\Loader\Interfaces\LoaderInterface; | ||
use Symfony\Component\Filesystem\Filesystem; | ||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | ||
|
||
/** | ||
* Dashboard loader with basic content fetching. | ||
* | ||
* @author Gorka Laucirica <gorka.lauzirika@gmail.com> | ||
* @author Beñat Espiña <benatespina@gmail.com> | ||
*/ | ||
class DashboardLoader implements LoaderInterface | ||
{ | ||
/** | ||
* The configuration. | ||
* | ||
* @var \LIN3S\KnowledgeBase\Configuration | ||
*/ | ||
protected $configuration; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param \LIN3S\KnowledgeBase\Configuration $configuration | ||
*/ | ||
public function __construct(Configuration $configuration) | ||
{ | ||
$this->configuration = $configuration; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function get($path) | ||
{ | ||
$filename = $this->configuration->buildPath() . 'html/' . $path . '.html'; | ||
$filesystem = new Filesystem(); | ||
if (false === $filesystem->exists($filename)) { | ||
throw new NotFoundHttpException(); | ||
} | ||
|
||
return file_get_contents($filename); | ||
} | ||
} |
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,57 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Knowledge Base package. | ||
* | ||
* Copyright (c) 2015 LIN3S <info@lin3s.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace LIN3S\KnowledgeBase\Loader; | ||
|
||
use LIN3S\KnowledgeBase\Configuration; | ||
use LIN3S\KnowledgeBase\Loader\Interfaces\LoaderInterface; | ||
use Symfony\Component\Filesystem\Filesystem; | ||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | ||
|
||
/** | ||
* HTML loader with basic content fetching. | ||
* | ||
* @author Gorka Laucirica <gorka.lauzirika@gmail.com> | ||
* @author Beñat Espiña <benatespina@gmail.com> | ||
*/ | ||
class HtmlLoader implements LoaderInterface | ||
{ | ||
/** | ||
* The configuration. | ||
* | ||
* @var \LIN3S\KnowledgeBase\Configuration | ||
*/ | ||
protected $configuration; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param \LIN3S\KnowledgeBase\Configuration $configuration | ||
*/ | ||
public function __construct(Configuration $configuration) | ||
{ | ||
$this->configuration = $configuration; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function get($path) | ||
{ | ||
$filename = $this->configuration->buildPath() . 'html/' . $path . '.html'; | ||
$filesystem = new Filesystem(); | ||
if (false === $filesystem->exists($filename)) { | ||
throw new \Exception('This page does not exist'); | ||
} | ||
|
||
return file_get_contents($filename); | ||
} | ||
} |
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