Skip to content

Commit

Permalink
Added zammad_api_client_php test job.
Browse files Browse the repository at this point in the history
  • Loading branch information
martini committed Sep 22, 2016
1 parent d8913ee commit 41d551e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 20 deletions.
22 changes: 21 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,27 @@ test:browser:integration:api_client_ruby:
- cd zammad_api_client_ruby
- bundle install
- export TEST_URL=http://$IP:$BROWSER_PORT
- rspec spec/zammad_api_spec.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1
- rspec || (cd .. && script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1)
- cd .. && script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1

test:browser:integration:api_client_php:
stage: browser
dependencies:
- browser:build
tags:
- browser
script:
- RAILS_ENV=test rake db:create
- cp contrib/auto_wizard_test.json auto_wizard.json
- script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1
- GIT_SSH=/ssh_wrapper_client_php.sh git clone [email protected]:martini/zammad_api_client_php || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1
- wget http://$IP:$BROWSER_PORT/api/v1/getting_started/auto_wizard
- cd zammad_api_client_php
- composer install
- export ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_URL=http://$IP:$BROWSER_PORT
- export [email protected]
- export ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_PASSWORD=test
- vendor/bin/phpunit || (cd .. && script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1)
- cd .. && script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1

test:browser:twitter_ff:
Expand Down
38 changes: 19 additions & 19 deletions test/unit/job_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,19 +134,19 @@ class JobTest < ActiveSupport::TestCase
assert_not(job1.executable?)

job1.last_run_at = Time.zone.now - 15.minutes
job1.save
job1.save!
assert_not(job1.executable?)

job1.updated_at = Time.zone.now - 15.minutes
job1.save
job1.save!
assert(job1.executable?)

job1.active = false
job1.save
job1.save!
assert_not(job1.executable?)

job1.active = true
job1.save
job1.save!
assert_not(job1.executable?)

assert_not(job1.in_timeplan?)
Expand All @@ -161,11 +161,11 @@ class JobTest < ActiveSupport::TestCase
6 => 'Sat',
}
job1.timeplan['days'][day_map[time.wday]] = true
job1.save
assert_not(job1.in_timeplan?)
job1.save!
assert_not(job1.in_timeplan?(time))
job1.timeplan['hours'][time.hour.to_s] = true
job1.save
assert_not(job1.in_timeplan?)
job1.save!
assert_not(job1.in_timeplan?(time))
min = time.min
if min < 9
min = 0
Expand All @@ -181,19 +181,19 @@ class JobTest < ActiveSupport::TestCase
min = 50
end
job1.timeplan['minutes'][min.to_s] = true
job1.save
assert(job1.in_timeplan?)
job1.save!
assert(job1.in_timeplan?(time))

job1.timeplan['hours'][time.hour] = true
job1.save
job1.save!

job1.timeplan['minutes'][min] = true
job1.save
assert(job1.in_timeplan?)
job1.save!
assert(job1.in_timeplan?(time))

# execute jobs
job1.updated_at = Time.zone.now - 15.minutes
job1.save
job1.save!
Job.run

assert(job1.next_run_at)
Expand Down Expand Up @@ -223,7 +223,7 @@ class JobTest < ActiveSupport::TestCase

# execute jobs again
job1.updated_at = Time.zone.now - 15.minutes
job1.save
job1.save!
Job.run

# verify changes on tickets
Expand Down Expand Up @@ -547,13 +547,13 @@ class JobTest < ActiveSupport::TestCase
assert_equal('2016-03-25 01:40:00 UTC', next_run_at.to_s)

job1.last_run_at = Time.zone.parse('2016-03-18 10:00:01 UTC')
job1.save
job1.save!
time_now = Time.zone.parse('2016-03-18 10:00:02 UTC')
next_run_at = job1.next_run_at_calculate(time_now)
assert_equal('2016-03-18 10:40:00 UTC', next_run_at.to_s)

job1.last_run_at = Time.zone.parse('2016-03-18 10:40:01 UTC')
job1.save
job1.save!
time_now = Time.zone.parse('2016-03-18 10:40:02 UTC')
next_run_at = job1.next_run_at_calculate(time_now)
assert_equal('2016-03-21 01:00:00 UTC', next_run_at.to_s)
Expand Down Expand Up @@ -631,13 +631,13 @@ class JobTest < ActiveSupport::TestCase
assert_equal('2016-03-18 00:00:00 UTC', next_run_at.to_s)

job1.last_run_at = Time.zone.parse('2016-03-17 23:45:01 UTC')
job1.save
job1.save!
time_now = Time.zone.parse('2016-03-17 23:51:23 UTC')
next_run_at = job1.next_run_at_calculate(time_now)
assert_equal('2016-03-18 00:00:00 UTC', next_run_at.to_s)

job1.last_run_at = Time.zone.parse('2016-03-17 23:59:01 UTC')
job1.save
job1.save!
time_now = Time.zone.parse('2016-03-17 23:59:23 UTC')
next_run_at = job1.next_run_at_calculate(time_now)
assert_equal('2016-03-18 00:40:00 UTC', next_run_at.to_s)
Expand Down

0 comments on commit 41d551e

Please sign in to comment.