[Ivan Diaz] - Remaname server folder to api

This commit is contained in:
Ivan Diaz 2016-01-27 13:40:25 -03:00
parent 7530512663
commit b9eefa3213
21 changed files with 5 additions and 80 deletions

4
.gitignore vendored
View File

@ -21,11 +21,11 @@ build/Release
# Dependency directories
node_modules
bower_components
server/vendor
api/vendor
# Build files
build
server/composer.lock
api/composer.lock
.idea
.jshintrc

View File

0
api/tests/lib/.gitkeep Normal file
View File

View File

@ -17,7 +17,7 @@ gulp.task('server', function() {
server.use(express.static(config.buildDir));
// Proxy php server api
server.use('/server', proxy('http://localhost:8080/', {
server.use('/api', proxy('http://localhost:8080/', {
forwardPath: function(req, res) {
return require('url').parse(req.url).path;
}
@ -41,4 +41,4 @@ gulp.task('server', function() {
s.listen(config.serverport);
});
});

View File

@ -1,75 +0,0 @@
<?php
class Stub {
private $function;
private $timesCalled = 0;
private $lastArgs = null;
public function __construct($function = null) {
$this->function = ($function === null) ? function (){} : $function;
}
public function __invoke() {
$this->timesCalled++;
$this->lastArgs = func_get_args();
return call_user_func_array($this->function, func_get_args());
}
public function returns($arg) {
$this->function = function () use ($arg) {
return $arg;
};
return $this;
}
public function hasBeenCalled() {
return !!$this->timesCalled;
}
public function reset() {
$this->timesCalled = 0;
$this->lastArgs = null;
}
public function hasBeenCalledWithArgs() {
$argumentsMatchAssertion = serialize(func_get_args()) === serialize($this->lastArgs);
return $this->timesCalled && $argumentsMatchAssertion;
}
}
class Mock {
public static function stub() {
return new Stub;
}
public function __construct($arguments = array()) {
if (!empty($arguments)) {
foreach ($arguments as $property => $argument) {
if ($argument instanceOf Closure) {
$this->{$property} = self::stub($argument);
} else {
$this->{$property} = $argument;
}
}
}
}
public function __set($key, $value){
if ($value instanceOf Closure) {
$this->{$key} = self::stub($value);
} else {
$this->{$key} = $value;
}
}
public function __call($method, $arguments) {
if (isset($this->{$method}) && is_callable($this->{$method})) {
return call_user_func_array($this->{$method}, $arguments);
} else {
throw new Exception("Fatal error: Call to undefined method stdObject::{$method}()");
}
}
}

View File

@ -4,7 +4,7 @@ import $ from 'jquery';
const APIUtils = {
root: 'http://localhost:3000/server/',
root: 'http://localhost:3000/api/',
getPromise(path, method, data) {
return (resolve, reject) => {