public function testModelQuery() { Resource::register('Foo'); $model = new Foo\SampleModelConfigured(); $model->id = 2; $query = $model->getModelQuery(); $this->assertAttributeEquals('sample_model_configureds/2', 'path', $query); }
/** * Get the resource instance for this model * @return Resto\Common\Resource */ public static function getResource() { $namespace = Str::classNamespace(get_called_class()); if (!$namespace) { throw new InvalidResourceException('Model must be inside a namespace.'); } return Resource::resolve($namespace); }
public function setUp() { $resource = Resource::register('Foo'); }
public function setUp() { $this->query = new Query(Resource::register('Foo')); }
/** * @expectedException Resto\Exception\Exception * @expectedExceptionMessage Foo is not a valid class type to register */ public function testInvalidClassRegister() { $res = Resource::register('Foo\\Bar'); $res->registerClass('Foo', 'Foo\\Collection'); }