public function test() { $channel = new ObjectModel\Channel(); $channel->SetType("test"); $channel->SetUpdatePeriod(5); $channel->SetParameters(array("feedUrl" => "http://something", "something" => "elshdjsh87d7f76&^&*^SHGGT^&")); Modules\DataContext\MySql_V1\DataContext::AddNewChannelProgessingJob($channel); Modules\DataContext\MySql_V1\DataContext::ActivateChannelProcessingJob($channel); $channel = Modules\DataContext\MySql_V1\DataContext::SelectNextDueChannelProcessingJob(time()); $this->assertEquals(true, isset($channel)); $channels = Modules\DataContext\MySql_V1\DataContext::ListAllChannelProcessingJobs(); $found = false; foreach ($channels as $c) { if ($c->GetId() == $channel->GetId()) { $found = true; } } $this->assertEquals(true, $found); Modules\DataContext\MySql_V1\DataContext::DeactivateChannelProcessingJob($channel); Modules\DataContext\MySql_V1\DataContext::RemoveChannelProcessingJob($channel); $channels = Modules\DataContext\MySql_V1\DataContext::ListAllChannelProcessingJobs(); $found = false; foreach ($channels as $c) { if ($c->GetId() == $channel->GetId()) { $found = true; } } $this->assertEquals(false, $found); }
public function test() { $channel = new ObjectModel\Channel(); $channel->id = "testId"; $channel->type = "test"; $channel->updatePeriod = 5; $channel->parameters = array("feedUrl" => "http://something", "something" => "elshdjsh87d7f76&^&*^SHGGT^&"); Modules\DataContext\MySql_V1\DataContext::SaveChannelProgessingJob($channel); $channel = Modules\DataContext\MySql_V1\DataContext::SelectNextDueChannelProcessingJob(time()); $this->assertEquals(true, isset($channel)); $channels = Modules\DataContext\MySql_V1\DataContext::ListAllChannelProcessingJobs(); $found = false; foreach ($channels as $c) { if ($c->GetId() == $channel->GetId()) { $found = true; } } Modules\DataContext\MySql_V1\DataContext::MarkChannelProcessingJobAsComplete($channel); $channels = Modules\DataContext\MySql_V1\DataContext::ListAllChannelProcessingJobs(); $found = false; foreach ($channels as $c) { if ($c->GetId() == $channel->GetId()) { $lastsucess = $c->lastSucess; $this->assertEquals(true, isset($lastsucess)); if (isset($lastsucess)) { $this->assertEquals(true, $lastsucess <= time()); } $found = true; } } $this->assertEquals(true, $found); Modules\DataContext\MySql_V1\DataContext::RemoveChannelProcessingJob($channel); $channels = Modules\DataContext\MySql_V1\DataContext::ListAllChannelProcessingJobs(); $found = false; foreach ($channels as $c) { if ($c->GetId() == $channel->GetId()) { $found = true; } } $this->assertEquals(false, $found); }