ExtJS-Generator-DBIC
view release on metacpan or search on metacpan
use strict;
use warnings;
use Test::More;
use Test::Exception;
use Test::Differences;
use File::Temp ();
use ExtJS::Generator::DBIC::Model;
use Data::Dump::JavaScript qw( false true );
use lib 't/lib';
BEGIN {
if ($] < 5.022) {
require POSIX;
POSIX::setlocale(&POSIX::LC_ALL, 'C');
}
}
my $generator = ExtJS::Generator::DBIC::Model->new(
schemaname => 'My::Schema',
appname => 'MyApp',
json_args => {
space_after => 1,
indent => 1,
},
extjs_args => { extend => 'MyApp.data.Model' },
);
my $extjs_model_for_another;
lives_ok { $extjs_model_for_another = $generator->extjs_model('Another') }
"generation of 'Another' successful";
eq_or_diff(
$extjs_model_for_another, [
'MyApp.model.Another', {
extend => 'MyApp.data.Model',
alias => 'model.another',
fields => [ {
name => 'id',
persist => false,
type => 'int',
}, {
allowNull => true,
name => 'num',
type => 'int',
},
],
idProperty => 'id',
#alias => 'model.another',
requires => [
'Ext.data.field.Integer',
],
#uses => [
# 'MyApp.model.Basic',
#],
}
],
"'Another' model ok"
);
my $extjs_models;
lives_ok { $extjs_models = $generator->extjs_models; }
'generation successful';
eq_or_diff(
$extjs_models, {
( run in 1.361 second using v1.01-cache-2.11-cpan-140bd7fdf52 )