From 407fbebc2da14520942e0a6a9220a5a3cfc4a7ad Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Thu, 15 May 2014 03:41:49 +0200 Subject: rename businesslayer to service --- tests/acceptance/Gemfile | 7 - tests/acceptance/Gemfile.lock | 55 -- tests/acceptance/Makefile | 30 - tests/acceptance/features/create_new.feature | 27 - .../features/step_definitions/basic_steps.rb | 25 - .../features/step_definitions/create_new_steps.rb | 47 -- tests/acceptance/features/support/env.rb | 28 - tests/acceptance/features/support/headless.rb | 34 - tests/acceptance/logs/.gitignore | 1 - tests/acceptance/run.sh | 80 --- tests/acceptance/static/kernel.org.atom | 165 ----- tests/unit/businesslayer/BusinessLayerTest.php | 97 --- tests/unit/businesslayer/FeedBusinessLayerTest.php | 723 --------------------- .../unit/businesslayer/FolderBusinessLayerTest.php | 275 -------- tests/unit/businesslayer/ItemBusinessLayerTest.php | 367 ----------- tests/unit/businesslayer/StatusFlagTest.php | 60 -- tests/unit/controller/ExportControllerTest.php | 27 +- tests/unit/controller/FeedApiControllerTest.php | 86 ++- tests/unit/controller/FeedControllerTest.php | 106 +-- tests/unit/controller/FolderApiControllerTest.php | 62 +- tests/unit/controller/FolderControllerTest.php | 87 +-- tests/unit/controller/ItemApiControllerTest.php | 70 +- tests/unit/controller/ItemControllerTest.php | 72 +- tests/unit/service/FeedServiceTest.php | 723 +++++++++++++++++++++ tests/unit/service/FolderServiceTest.php | 275 ++++++++ tests/unit/service/ItemServiceTest.php | 367 +++++++++++ tests/unit/service/ServiceTest.php | 97 +++ tests/unit/service/StatusFlagTest.php | 60 ++ tests/unit/utility/UpdaterTest.php | 38 +- 29 files changed, 1796 insertions(+), 2295 deletions(-) delete mode 100644 tests/acceptance/Gemfile delete mode 100644 tests/acceptance/Gemfile.lock delete mode 100644 tests/acceptance/Makefile delete mode 100644 tests/acceptance/features/create_new.feature delete mode 100644 tests/acceptance/features/step_definitions/basic_steps.rb delete mode 100644 tests/acceptance/features/step_definitions/create_new_steps.rb delete mode 100644 tests/acceptance/features/support/env.rb delete mode 100644 tests/acceptance/features/support/headless.rb delete mode 100644 tests/acceptance/logs/.gitignore delete mode 100644 tests/acceptance/run.sh delete mode 100644 tests/acceptance/static/kernel.org.atom delete mode 100644 tests/unit/businesslayer/BusinessLayerTest.php delete mode 100644 tests/unit/businesslayer/FeedBusinessLayerTest.php delete mode 100644 tests/unit/businesslayer/FolderBusinessLayerTest.php delete mode 100644 tests/unit/businesslayer/ItemBusinessLayerTest.php delete mode 100644 tests/unit/businesslayer/StatusFlagTest.php create mode 100644 tests/unit/service/FeedServiceTest.php create mode 100644 tests/unit/service/FolderServiceTest.php create mode 100644 tests/unit/service/ItemServiceTest.php create mode 100644 tests/unit/service/ServiceTest.php create mode 100644 tests/unit/service/StatusFlagTest.php (limited to 'tests') diff --git a/tests/acceptance/Gemfile b/tests/acceptance/Gemfile deleted file mode 100644 index 353eb5fe6..000000000 --- a/tests/acceptance/Gemfile +++ /dev/null @@ -1,7 +0,0 @@ -source 'https://rubygems.org' - -gem 'cucumber' -gem 'capybara' -gem 'selenium-webdriver' -gem 'headless' -gem 'rspec' diff --git a/tests/acceptance/Gemfile.lock b/tests/acceptance/Gemfile.lock deleted file mode 100644 index a886a54e9..000000000 --- a/tests/acceptance/Gemfile.lock +++ /dev/null @@ -1,55 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - builder (3.2.0) - capybara (2.1.0) - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - xpath (~> 2.0) - childprocess (0.3.9) - ffi (~> 1.0, >= 1.0.11) - cucumber (1.3.1) - builder (>= 2.1.2) - diff-lcs (>= 1.1.3) - gherkin (~> 2.12.0) - multi_json (~> 1.3) - diff-lcs (1.2.4) - ffi (1.8.1) - gherkin (2.12.0) - multi_json (~> 1.3) - headless (1.0.1) - mime-types (1.23) - multi_json (1.7.3) - nokogiri (1.5.9) - rack (1.5.2) - rack-test (0.6.2) - rack (>= 1.0) - rspec (2.13.0) - rspec-core (~> 2.13.0) - rspec-expectations (~> 2.13.0) - rspec-mocks (~> 2.13.0) - rspec-core (2.13.1) - rspec-expectations (2.13.0) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.13.1) - rubyzip (0.9.9) - selenium-webdriver (2.32.1) - childprocess (>= 0.2.5) - multi_json (~> 1.0) - rubyzip - websocket (~> 1.0.4) - websocket (1.0.7) - xpath (2.0.0) - nokogiri (~> 1.3) - -PLATFORMS - ruby - -DEPENDENCIES - capybara - cucumber - headless - rspec - selenium-webdriver diff --git a/tests/acceptance/Makefile b/tests/acceptance/Makefile deleted file mode 100644 index d8b4d79bb..000000000 --- a/tests/acceptance/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# ownCloud - News -# -# @author Bernhard Posselt -# @copyright 2012 Bernhard Posselt dev@bernhard-posselt.com -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -# License as published by the Free Software Foundation; either -# version 3 of the License, or any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU AFFERO GENERAL PUBLIC LICENSE for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with this library. If not, see . - -# This makefile is for general project specific stuff like packaging a new -# release for the app store and running php unittests which require core - -bash=/bin/bash - -all: acceptance - -acceptance: - $(bash) run.sh - -headless: - export HEADLESS=true && $(bash) run.sh \ No newline at end of file diff --git a/tests/acceptance/features/create_new.feature b/tests/acceptance/features/create_new.feature deleted file mode 100644 index 9e5d9708f..000000000 --- a/tests/acceptance/features/create_new.feature +++ /dev/null @@ -1,27 +0,0 @@ -# encoding: utf-8 -Feature: create_new - In order to start using the news rss reader - As a user - I want to be able to add feeds and folders - - Background: - Given I am logged in - And I am in the "news" app - - Scenario: default state when opening page - When I look at the add new button - Then I should not see a caption on the add new button - And I should not see a form to add feeds and folders - - Scenario: show caption on hover - When I hover over the add new button - Then I should see a "Add Website" caption on the add new button - - Scenario: show add website dialogue - When I click on the add new button - Then I should see a form to add feeds and folders - - Scenario: hide add website dialogue when clicking somewhere else - Given I click on the add new button - When I click somewhere else - Then I should not see a form to add feeds and folders \ No newline at end of file diff --git a/tests/acceptance/features/step_definitions/basic_steps.rb b/tests/acceptance/features/step_definitions/basic_steps.rb deleted file mode 100644 index f62fdf9c7..000000000 --- a/tests/acceptance/features/step_definitions/basic_steps.rb +++ /dev/null @@ -1,25 +0,0 @@ -Given (/^I am logged in$/) do - - # be sure to use the right browser session - Capybara.session_name = 'test' - - # logout - just to be sure - visit '/index.php?logout=true' - visit '/' - fill_in 'user', with: 'test' - fill_in 'password', with: "test" - click_button 'submit' - - # if visibility is not set to false it will fail - page.should have_selector('a#logout', :visible => false) -end - -Given (/^I am in the "([^"]+)" app$/) do |app| - visit "/index.php/apps/#{app}/" - page.should have_selector('a#logout', :visible => false) -end - -When (/^I go to "([^"]+)"$/) do |path| - visit "#{path}" - page.should have_selector('a#logout', :visible => false) -end \ No newline at end of file diff --git a/tests/acceptance/features/step_definitions/create_new_steps.rb b/tests/acceptance/features/step_definitions/create_new_steps.rb deleted file mode 100644 index 5b1d761e2..000000000 --- a/tests/acceptance/features/step_definitions/create_new_steps.rb +++ /dev/null @@ -1,47 +0,0 @@ -# use this to turn off animations to check for visibility -def turn_off_animations - page.execute_script("$.fx.off=true") -end - -When (/^I look at the add new button$/) do -end - -When (/^I hover over the add new button$/) do - # FIXME: get this working with hover action - page.execute_script("$('.list-title span').show()") -end - -When (/^I hover out off the add new button$/) do - # FIXME: get this working with hover action - page.execute_script("$('.list-title span').hide()") -end - -Then (/^I should (not )?see a (?:"([^"]+)" )?caption on the add new button$/) do |shouldNot, caption| - selector = "//li[contains(@class,\"add-new\")]/a/span[1]" - if shouldNot - page.should have_no_selector(:xpath, selector) - else - page.find(:xpath, selector).should have_content(caption) - end -end - - -When (/^I click on the add new button$/) do - turn_off_animations() - click_link 'Add Website' -end - -When (/^I click somewhere else$/) do - page.execute_script("$('#app-content').trigger('click')") -end - - -Then (/^I should (not )?see a form to add feeds and folders$/) do |shouldNot| - selector = "//*[contains(@class,\"add-new-popup\")]" - - if shouldNot - page.should have_no_selector(:xpath, selector) - else - page.should have_selector(:xpath, selector) - end -end diff --git a/tests/acceptance/features/support/env.rb b/tests/acceptance/features/support/env.rb deleted file mode 100644 index 91af642bf..000000000 --- a/tests/acceptance/features/support/env.rb +++ /dev/null @@ -1,28 +0,0 @@ -require 'bundler/setup' -require 'capybara/cucumber' -require 'selenium-webdriver' - -Encoding.default_external = Encoding::UTF_8 -Encoding.default_internal = Encoding::UTF_8 - -Capybara.register_driver :selenium do |app| - http_client = Selenium::WebDriver::Remote::Http::Default.new - http_client.timeout = 200 - Capybara::Selenium::Driver.new(app, :browser => :firefox, :http_client => http_client) -end - -# -# app and app_host are set via command line parameter on cucumber call: -# cucumber HOST=33.33.33.10 -# -host = ENV['HOST'] -host ||= '33.33.33.10' - -Capybara.app = host -Capybara.run_server = false -Capybara.app_host = "http://#{host}" -Capybara.default_selector = :css -Capybara.default_driver = :selenium - -# serve static files -#run Rack::Directory.new Dir.pwd.concat('./static') \ No newline at end of file diff --git a/tests/acceptance/features/support/headless.rb b/tests/acceptance/features/support/headless.rb deleted file mode 100644 index a2095205f..000000000 --- a/tests/acceptance/features/support/headless.rb +++ /dev/null @@ -1,34 +0,0 @@ -# only run when export HEADLESS=true -if ENV['HEADLESS'] == 'true' - - require 'headless' - - headless = Headless.new - headless.start - - at_exit do - headless.destroy - end - - Before do - #headless.video.start_capture - end - - After do |scenario| - # for demo purpose: always record ;-) - #video= video_path(scenario) - #puts "Writing video to #{File.expand_path(video)}" - #headless.video.stop_and_save(video) - - # if scenario.failed? - # headless.video.stop_and_save(video_path(scenario)) - # else - # headless.video.stop_and_discard - # end - end - - def video_path(scenario) - "#{scenario.name.split.join("_")}.mov" - end - -end \ No newline at end of file diff --git a/tests/acceptance/logs/.gitignore b/tests/acceptance/logs/.gitignore deleted file mode 100644 index a6c57f5fb..000000000 --- a/tests/acceptance/logs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.json diff --git a/tests/acceptance/run.sh b/tests/acceptance/run.sh deleted file mode 100644 index 2a6afbfd2..000000000 --- a/tests/acceptance/run.sh +++ /dev/null @@ -1,80 +0,0 @@ -# ownCloud - News -# -# @author Bernhard Posselt -# @copyright 2013 Bernhard Posselt dev@bernhard-posselt.com -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -# License as published by the Free Software Foundation; either -# version 3 of the License, or any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU AFFERO GENERAL PUBLIC LICENSE for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with this library. If not, see . - - - -# set up rvm and xvfb dependencies -if [[ ! -e "/usr/bin/xvfb-run" ]]; then - - # archlinux - if [[ -e "/usr/bin/pacman" ]]; then - echo "installing xvfb, please enter password..." - sudo pacman -S xorg-server-xvfb - - # fedora - elif [[ -e "/usr/bin/yum" ]]; then - echo "installing xvfb, please enter password..." - yum install xorg-x11-server-Xvfb - - # debian - elif [[ -e "/usr/bin/apt-get" ]]; then - echo "installing xvfb, please enter password..." - sudo apt-get install xvfb - - else - echo "You have to install xvfb in order to run the test suite" - exit 1 - fi -fi - - -# dont use --user-install for gems since this breaks rvm. abort setup in case it -# exists -if [[ -e "/etc/gemrc" ]]; then - if grep -qe "^[^#].*user-install" /etc/gemrc; then - echo "Found --user-install in /etc/gemrc" - echo "Please remove it, as it will break rubygems in RVM." - exit 1 - fi -fi - -# set up rvm -if [[ -f "$HOME/.rvm/scripts/rvm" ]]; then - source "$HOME/.rvm/scripts/rvm" -elif [[ -f "/usr/local/rvm/scripts/rvm" ]]; then - source "/usr/local/rvm/scripts/rvm" -else - # set up a local rvm installation - curl -L get.rvm.io | bash -s stable - [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" -fi - - -# Set the gemset and ruby version -rvm install 2.0.0 -rvm use ruby-2.0.0@oc_news_acceptance --create - -# install dep libraries -bundle install - -# if the OWNCLOUD_HOST variable is not set it will default to localhost/owncloud -if [[ -z "$OWNCLOUD_HOST" ]]; then - export OWNCLOUD_HOST='localhost/owncloud' -fi - -cucumber -f json -o ./logs/owncloud.json -f pretty HOST=$OWNCLOUD_HOST features \ No newline at end of file diff --git a/tests/acceptance/static/kernel.org.atom b/tests/acceptance/static/kernel.org.atom deleted file mode 100644 index dd89453ec..000000000 --- a/tests/acceptance/static/kernel.org.atom +++ /dev/null @@ -1,165 +0,0 @@ - -The Linux Kernel Archives - - -https://www.kernel.org/ -2013-05-07T00:00:00+00:00 - -Fifty shades of Tux - -2013-05-07T00:00:00+00:00 - - - - -tag:https://www.kernel.org,2013-05-07:fifty-shades-of-tux.html - - -

Special thanks to Benoît Monin for donating a MIT-licensed CSS theme to the kernel.org project to replace the one we hastily put together. Though the Pelican authors have since obtained a free-license commitment from the copyright owners of the CSS files shipping with Pelican, we wanted to have something that looked a bit less like the default theme anyway.

If anyone else wants to participate, full sources of the kernel.org website are available from the git repository.

-
-
- -Frequently asked questions - -2013-04-02T22:13:02+00:00 - - - -tag:https://www.kernel.org,2013-04-02:faq.html - -

If you have questions, comments or concerns about the F.A.Q. please contact us at webmaster@kernel.org.

Is Linux Kernel Free Software?

Linux kernel is released under GNU GPL version 2 and is therefore Free Software as defined by the Free Software Foundation. You may read the entire copy of the license in the COPYING file distributed with each release of the Linux kernel.

There are a number of kernels marked as 'stable', which one is stable?

There are a number of reasons there are multiple kernels marked as 'stable'. The stable series kernels stem from a conversation that happened in 2004, it has evolved into a number of kernels that are currently being maintained under the 'stable' moniker.

These kernels have patches that are backported to them, mainly in the form of driver updates and security fixes. Some of these trees have been declared to have longer life cycles than others.

Please check the Releases page for more info.

What does "stable/EOL" and "longterm" mean?

As kernels move from the "mainline" into the "stable" category, two things can happen:

  1. They can reach "End of Life" after a few bugfix revisions, which means that kernel maintainers will release no more bugfixes for this kernel version, or
  2. They can be put into "longterm" maintenance, which means that maintainers will provide bugfixes for this kernel revision for a much longer period of time.

If the kernel version you are using is marked "EOL," you should consider upgrading to the next major version as there will be no more bugfixes provided for the kernel version you are using.

Please check the Releases page for more info.

Is there an RSS feed for the latest kernel version?

Yes, and you can find it at https://www.kernel.org/feeds/kdist.xml.

We also publish a .json file with the latest release information, which you can pull from here: https://www.kernel.org/releases.json.

Why are there files that are dated tomorrow?

All timestamps on kernel.org are in UTC (Coordinated Universal Time). If you live in the western hemisphere your local time lags behind UTC. Under Linux/Unix, type date -u to get the current time in UTC.

Can I get an account on kernel.org?

Kernel.org accounts are not given away very often, usually you need to be making some reasonable amount of contributions to the Linux kernel and have a good reason for wanting / needing an account. If you really feel that you should have an account please e-mail the following to keys@kernel.org:

  • full name
  • email address
  • desired username
  • reason for account
  • reference to work you've done
  • PGP/GPG public key fingerprint (NOT an ssh key)
    • Key should be signed by as many kernel developers as you can get
    • Accounts will not issued until key is suffciently signed
    • Key must have been uploaded to public key servers

The Kernel.org admin team will then review your request and let you know the decision.

Please note that The Linux Kernel Organization, Inc. reserves the right to refuse service to anyone, for any reason.

I have cool project X, can you guys mirror it for me?

Probably not. Kernel.org deals with the Linux kernel, various distributions of the kernel and larger repositories of packages. We do not mirror individual projects, software, etc as we feel there are better places providing mirrors for those kinds of repositories. If you feel that kernel.org should mirror your project, please contact ftpadmin@kernel.org with the following information:

  • name
  • project name
  • project website
  • detailed project description
  • reason for wanting us to mirror

The Kernel.org admin team will then review your request and talk to you about it. As with any kind of account on kernel.org it's up to the discretion of the admin team.

How does kernel.org provide its users access to the git trees?

We are using an access control system called gitolite, originally written and maintained by Sitaram Chamarty. We choose gitolite for a number of reasons:

  • Limiting of ssh access to the system
  • Fine grained control over repository access
  • Well maintained and supported code base
  • Responsive development
  • Broad and diverse install base

As well at the time of deployment the code had undergone an external code review.

How do I create an -rc kernel? I get "Reversed patch detected!"

-rc kernel patches are generated from the base stable release.

For example: to create the 2.6.14-rc5 kernel, you must:

  • download 2.6.13 (not 2.6.13.4)
  • and then apply the 2.6.14-rc5 patch.

Yes, you want 2.6.13, not 2.6.14. Remember, that's an -rc kernel, as in, 2.6.14 doesn't exist yet. :)

Where can I find kernel 2.4.20-3.16?

Kernel version numbers of this form are distribution kernels, meaning they are modified kernels produced by distributions. Please contact the relevant distributor; or check out http://mirrors.kernel.org/.

See the Releases page for more info on distribution kernels.

I need help building/patching/fixing Linux kernel/modules/drivers!

Please see the Kernel Newbies website.

There is also a wealth of knowledge on many topics involving Linux at The Linux Documentation Project (http://www.tldp.org)

For finding or reporting bugs, look through the archives for the various Linux mailing lists, and if no specific list seems appropriate, try the browsing the Linux Kernel Mailing List.

When will the next kernel be released?

The next kernel will be released when it is ready. There is no strict timeline for making releases, but if you really need an educated guess, visit the Linux kernel PHB Crystal Ball -- it tries to provide a ballpark guess based on previous kernel release schedule.

What will go into the next release?

It is hard to predict with certainty, but you can either take a peek at linux-next or read the Linux Weather Forecast, where Jonathan Corbet provides a broad forecast of what will likely be included into the next mainline release.

-
-
- -The Linux Kernel Organization - -2013-03-12T19:56:43+00:00 - - - - -tag:https://www.kernel.org,2013-03-12:nonprofit.html - - -

The Linux Kernel Organization is a California Public Benefit Corporation established in 2002 to distribute the Linux kernel and other Open Source software to the public without charge. We are recognized by the IRS as a 501(c)3 private operating foundation.

The Linux Kernel Organization is managed by The Linux Foundation, which provides full technical, financial and staffing support for running and maintaining the kernel.org infrastructure.

-
-
- -Active kernel releases - -2013-03-12T19:56:43+00:00 - - - - -tag:https://www.kernel.org,2013-03-12:releases.html - - -

There are several main categories into which kernel releases may fall:

Prepatch
Prepatch or "RC" kernels are mainline kernel pre-releases that are mostly aimed at other kernel developers and Linux enthusiasts. They must be compiled from source and usually contain new features that must be tested before they can be put into a stable release. Prepatch kernels are maintained and released by Linus Torvalds.
Mainline
Mainline tree is maintained by Linus Torvalds. It's the tree where all new features are introduced and where all the exciting new development happens. New mainline kernels are released every 2-3 months.
Stable
After each mainline kernel is released, it is considered "stable." Any bug fixes for a stable kernel are backported from the mainline tree and applied by a designated stable kernel maintainer. There are usually only a few bugfix kernel releases until next mainline kernel becomes available -- unless it is designated a "longterm maintenance kernel." Stable kernel updates are released on as-needed basis, usually 2-3 a month.
Longterm
There are usually several "longterm maintenance" kernel releases provided for the purposes of backporting bugfixes for older kernel trees. Only important bugfixes are applied to such kernels and they don't usually see very frequent releases, especially for older trees.
Longterm release kernels
Version Maintainer Projected EOL
3.4 Greg Kroah-Hartman Oct, 2014
3.2 Ben Hutchings 2016
3.0 Greg Kroah-Hartman Oct, 2013
2.6.34 Paul Gortmaker Mid-2013
2.6.32 Willy Tarreau Mid-2014

Distribution kernels

Many Linux distributions provide their own "longterm maintenance" kernels that may or may not be based on those maintained by kernel developers. These kernel releases are not hosted at kernel.org and kernel developers can provide no support for them.

It is easy to tell if you are running a distribution kernel. Unless you downloaded, compiled and installed your own version of kernel from kernel.org, you are running a distribution kernel. To find out the version of your kernel, run uname -r:

 # uname -r 3.7.5-201.fc18.x86_64 

If you see anything at all after the dash, you are running a distribution kernel. Please use the support channels offered by your distribution vendor to obtain kernel support.

-
-
- -About Linux Kernel - -2013-03-12T19:56:43+00:00 - - - -tag:https://www.kernel.org,2013-03-12:linux.html - -

What is Linux?

Linux is a clone of the operating system Unix, written from scratch by Linus Torvalds with assistance from a loosely-knit team of hackers across the Net. It aims towards POSIX and Single UNIX Specification compliance.

It has all the features you would expect in a modern fully-fledged Unix, including true multitasking, virtual memory, shared libraries, demand loading, shared copy-on-write executables, proper memory management, and multistack networking including IPv4 and IPv6.

Although originally developed first for 32-bit x86-based PCs (386 or higher), today Linux also runs on a multitude of other processor architectures, in both 32- and 64-bit variants.

New to Linux?

If you're new to Linux, you don't want to download the kernel, which is just a component in a working Linux system. Instead, you want what is called a distribution of Linux, which is a complete Linux system. There are numerous distributions available for download on the Internet as well as for purchase from various vendors; some are general-purpose, and some are optimized for specific uses. We currently have mirrors of several distributions available at http://mirrors.kernel.org/.

Note, however, that most distributions are very large (several gigabytes), so unless you have a fast Internet link you may want to save yourself some hassle and purchase a CD-ROM with a distribution; such CD-ROMs are available from a number of vendors.

Mailing lists

The Linux kernel is discussed on the linux-kernel mailing list at vger.kernel.org. Please read the FAQ before subscribing.

Although there is no official archive site, unofficial archives of the list can be found at:

-
-
- -Contacts - -2013-03-12T19:56:43+00:00 - - - -tag:https://www.kernel.org,2013-03-12:contact.html - -

Email is the only reliable way of contacting Kernel.org administrators.

General contacts

webmaster@kernel.org:
General requests and comments about kernel.org infrastructure.
ftpadmin@kernel.org:
Questions or comments about kernel.org mirrors.
keys@kernel.org:
Account requests (see FAQ)

Please do not send general Linux questions or bug reports to these addresses. We do not have the resources to reply to them.

Please try the following sites for general Linux help:

Linux Foundation also offers training opportunities if you are interested in learning more about Linux, want to become a more proficient Linux systems administrator, or want to know more about how Linux can help your company succeed.

Mailing address

Please send any mail correspondence to the Linux Foundation:

The Linux Foundation
660 York Street, Suite 102
San Francisco, CA 94110
Phone/Fax: +1 415 723 9709
-
-
- -XZ by default and JSON - -2013-03-11T00:00:00+00:00 - - - - -tag:https://www.kernel.org,2013-03-11:xz-by-default-and-json.html - - -

We've implemented two oft-requested features today:

  1. The download links now default to .tar.xz versions of archives
  2. There is now a JSON file with the release information located in https://www.kernel.org/releases.json. If you've been screen-scraping the front page, please use this instead.

If you have any other feature suggestions, please send them to webmaster@kernel.org.

-
-
- -/pub tree resync-ing - -2013-03-08T00:00:00+00:00 - - - - -tag:https://www.kernel.org,2013-03-08:pub-tree-resync-ing.html - - -

Due to a failure in one of the rsync scripts during the maintenance window, the mirrors of /pub hierarchy on www.kernel.org got erased. We are resyncing them now from the master storage, but in the meantime you will probably get an occasional "Forbidden". The entirety of the archive should be rsync'ed in a few hours.

We apologize profusely for the problem and will fix the script to make sure this doesn't happen again.

Contents of git.kernel.org are unaffected.

-
-
- -Cleanroom styles - -2013-03-03T00:00:00+00:00 - - - - -tag:https://www.kernel.org,2013-03-03:cleanroom-styles.html - - -

You are probably wondering what happened to the site's look. Unfortunately, we've been alerted that the default theme shipped by Pelican (which we largely adapted) has an unclear license. Until this is cleared up, we've put together a quick-and-dirty cleanroom CSS reimplementation that preserves the functional aspects of the site, but sacrifices a lot of the bells and whistles.

If you are a CSS designer and would like to donate your own cleanroom style, please let us know at webmaster@kernel.org.

Our apologies, and we promise to keep a keener eye on licensing details of various templates distributed with open-source products.

-
-
- -Pelican - -2013-03-01T00:00:00+00:00 - - - -tag:https://www.kernel.org,2013-03-01:pelican.html - -

Welcome to the reworked kernel.org website. We have switched to using Pelican in order to statically render our site content, which simplifies mirroring and distribution. You can view the sources used to build this website in its own git repository.

Additionally, we have switched from using gitweb-caching to using cgit for browsing git repositories. There are rewrite rules in place to forward old gitweb URLs to the pages serviced by cgit, so there shouldn't be any broken links, hopefully. If you notice that something that used to work with gitweb no longer works for you with cgit, please drop us a note at webmaster@kernel.org.

-
-
- -Legal disclaimers and copyright - -2013-01-01T00:00:00+00:00 - - - -tag:https://www.kernel.org,2013-01-01:legal.html - -

Trademarks

Linux is a Registered Trademark of Linus Torvalds. All trademarks are property of their respective owners.

-
-
- -Linux kernel releases PGP signatures - -2013-01-01T00:00:00+00:00 - - - - -tag:https://www.kernel.org,2013-01-01:signature.html - - -

All kernel releases are cryptographically signed using OpenPGP-compliant signatures. Everyone is strongly encouraged to verify the integrity of downloaded kernel releases by verifying the corresponding signatures.

Linux kernel releases and all other files distributed via kernel.org mirrors are no longer signed by one centrally issued key. You will need to rely on the PGP Web of Trust in order to verify the authenticity of downloaded archives.

Basic concepts

Every kernel release comes with a cryptographic signature from the person making the release. This cryptographic signature allows anyone to verify whether the files have been modified or otherwise tampered with since the developer created and signed them. The signing and verification process uses public-key cryptography and it is next to impossible to forge a PGP signature without first gaining access to the developer's private key. If this does happen, the developers will revoke the compromised key and will re-sign all their previously signed releases with the new key.

To learn more about the way PGP works, please consult Wikipedia.

Kernel.org web of trust

In order for this section to make sense, you should first familiarize yourself with the way PGP Web of Trust works. You can start by reading the Wikipedia article on the subject.

In a few words, PGP keys used by members of kernel.org are cross-signed by other members of kernel.org (and, frequently, by many other people). If you wanted to verify the validity of any key belonging to a member of kernel.org, you could review the list of signatures on their public key and then make a decision whether you trust that key or not. This article from the GnuPG manual is a good first step towards understanding how you can use PGP trust relationships to validate keys: Using trust to validate keys.

In order to become part of the kernel.org web of trust, you should locate kernel.org members in your geographical area, then verify and sign their keys. To locate members of kernel.org in your area, you can either use the Google Map created for this purpose, or send an email to the users@kernel.org mailing list, requesting key signing.

Once you have verified and signed a few keys, you can use the trust relationship established in the process to verify other keys used in the kernel.org web of trust.

Using GnuPG to verify kernel signatures

All software released via kernel.org has corresponding PGP signatures. It should not be possible to upload any files to the kernel.org mirrors without providing a trusted PGP signature to go along with them.

To better illustrate the verification process, let's use Linux 3.1.5 release as a walk-through example. First, use "wget" or "curl -O" to download the release and the corresponding signature:

 $ wget https://www.kernel.org/pub/linux/kernel/v3.0/linux-3.1.5.tar.xz $ wget https://www.kernel.org/pub/linux/kernel/v3.0/linux-3.1.5.tar.sign 

You will notice that the signature is made against the uncompressed version of the archive. This is done so there is only one signature required for .gz, .bz2 and .xz compressed versions of the release. Start by uncompressing the archive, using unxz in our case:

 $ unxz linux-3.1.5.tar.xz 

Now verify the .tar archive against the signature:

 $ gpg --verify linux-3.1.5.tar.sign 

You can combine these steps into a one-liner:

 $ xz -cd linux-3.1.5.tar.xz | gpg --verify linux-3.1.5.tar.sign - 

The likely output will be:

 gpg: Signature made Fri 09 Dec 2011 12:16:46 PM EST using RSA key ID 6092693E gpg: Can't check signature: public key not found 

You will need to first download the public key from the PGP keyserver in order to verify the signature. Look at the first line of the output and note the "key ID" listed, which in our example is 6092693E. Now download this key from the key servers:

 $ gpg --recv-keys 6092693E gpg: requesting key 6092693E from hkp server subkeys.pgp.net gpg: key 6092693E: public key "Greg Kroah-Hartman (Linux kernel stable release signing key) <greg@kroah.com>" imported gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model gpg: depth: 0 valid: 3 signed: 1 trust: 0-, 0q, 0n, 0m, 0f, 3u gpg: depth: 1 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 1f, 0u gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) 

Let's rerun "gpg --verify":

 $ gpg --verify linux-3.1.5.tar.sign gpg: Signature made Fri 09 Dec 2011 12:16:46 PM EST using RSA key ID 6092693E gpg: Good signature from "Greg Kroah-Hartman (Linux kernel stable release signing key) <greg@kroah.com>" gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: 647F 2865 4894 E3BD 4571 99BE 38DB BDC8 6092 693E 

Notice the WARNING: This key is not certified with a trusted signature! You will now need to verify that the key used to sign the archive really does belong to the owner (in our example, Greg Kroah-Hartman). There are several ways you can do this:

  1. Use the Kernel.org web of trust. This will require that you first locate the members of kernel.org in your area and sign their keys. Short of meeting the actual owner of the PGP key in real life, this is your best option to verify the validity of a PGP key signature.
  2. Review the list of signatures on the developer's key by using "gpg --list-sigs". Email as many people who have signed the key as possible, preferably at different organizations (or at least different domains). Ask them to confirm that they have signed the key in question. You should attach at best marginal trust to the responses you receive in this manner (if you receive any).

If at any time you see "BAD signature" output from "gpg --verify", please first check that your download is correct and that the downloaded file is not truncated or otherwise corrupted. If you repeatedly get the same "BAD signature" output, email ftpadmin@kernel.org immediately, so we can investigate the problem.

Kernel.org checksum autosigner and sha256sums.asc

We have a dedicated off-the-network system that connects directly to our central attached storage and calculates checksums for all uploaded software releases. The generated sha256sums.asc file is then signed with a PGP key generated for this purpose and that doesn't exist outside of that system.

These checksums are NOT intended to replace the web of trust. It is merely a way for someone to quickly verify whether contents on one of the many kernel.org mirrors match the contents on the master mirror. While you may use them to quickly verify whether what you have downloaded matches what we have on our central storage system, you should still use the GPG web of trust to verify whether the release tarball actually matches what the kernel developer published.

Kernel releases prior to September, 2011

Prior to September, 2011 all kernel releases were signed automatically by the same PGP key:

 pub 1024D/517D0F0E 2000-10-10 [revoked: 2011-12-11] Key fingerprint = C75D C40A 11D7 AF88 9981 ED5B C86B A06A 517D 0F0E uid Linux Kernel Archives Verification Key <ftpadmin@kernel.org> 

Due to the kernel.org systems compromise, this key has been retired and revoked. It will no longer be used to sign future releases and you should NOT use this key to verify the integrity of any archives. It is almost certain that this key has fallen into malicious hands.

All kernel releases that were previously signed with this key are being cross-checked and will be signed with another key, created specifically for this purpose. Once the process is completed, the new key information will be put on this page.

Revocation certificates

The following revocation certificates have been issued for keys used in the past to sign kernel.org software releases:

Key ID 0x517D0F0E

Key fingerprint:

 pub 1024D/517D0F0E 2000-10-10 [revoked: 2011-12-11] Key fingerprint = C75D C40A 11D7 AF88 9981 ED5B C86B A06A 517D 0F0E uid Linux Kernel Archives Verification Key <ftpadmin@kernel.org> 

Revocation certificate:

 -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: A revocation certificate should follow iIkEIBECAEkFAk7lL6xCHQJLZXkgd2FzIHVzZWQgdG8gYXV0b3NpZ25pbmc7IGF1 dG9zaWduaW5nIHNlcnZlciB3YXMgY29tcHJvbWlzZWQuAAoJEMhroGpRfQ8OS7EA nikD5S7mmNM0QRX+H4BDxvdWzXWyAKCTuDGOdLoZs8gnl/G5UKVjX9mVkg== =eL49 -----END PGP PUBLIC KEY BLOCK----- 

Key ID 0x1E1A8782

Key fingerprint:

 pub 1024D/1E1A8782 1999-10-05 [revoked: 2000-10-10] Key fingerprint = 9DB4 C3A4 EF2A 3111 9072 82F3 F2A5 75DC 1E1A 8782 uid Linux Kernel Archives Verification Key <ftpadmin@kernel.org> 

Revocation certificate:

 -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.0.0 (GNU/Linux) Comment: For info see http://www.gnupg.org Comment: A revocation certificate should follow iEYEIBECAAYFAjnisTIACgkQ8qV13B4ah4K3DgCfShKQe2kfz68OKu0WwEzgKkAE vIQAn3Y8CTCRZ9QEIwsIs93F501VUtPs =l5FV -----END PGP PUBLIC KEY BLOCK----- 

Key ID 0x514C5279

Key fingerprint:

 pub 1024R/514C5279 1998-12-16 [revoked: 1999-10-05] Key fingerprint = 59 B1 5F 6F E3 13 4C 8B 33 E5 14 35 21 F1 D1 03 uid Linux Kernel Archives <ftpadmin@kernel.org> 

Revocation certificate:

 -----BEGIN PGP PUBLIC KEY BLOCK----- Version: 2.6.3a mQCNAzZ4N0EAAAEEAJpp8Hy0n2FBJqmrfX9dha1Ja/Uc7f63Afbv0SBTE4i+xeyg 5O/4VWr11LlP1uAjM8Gvfw8neRMLhMUjvRaXPhRR9KoAaW84Bg0cBSyakY6j1JXz JcBVKGoGNgBo82cVM9bkE1/Qdy9v6pGDw3qhAqBNLDtYDUS8fgTPgU1RTFJ5AAUR iQCVAwUgN/p+yATPgU1RTFJ5AQGk3wP/YDsx7Wys/FSfBMpfQA+7IO5Ug2voBGDa hXHKIofT9H7/eYBr3Sctq+/eZAVwll1iS3dkzBIEuvbVlgVam/nvegfRrL2hKy7i ELespx5WEqfhnapawg/xpFRsPkYOq96IcoGSIQSwGCq4wqz/CwfG/tQx0eGP9k7j N176TIjYdzu0K0xpbnV4IEtlcm5lbCBBcmNoaXZlcyA8ZnRwYWRtaW5Aa2VybmVs Lm9yZz6JAJUDBRA2eFIpnE1kY6hrNcUBARi6BACbJhIzBynhTW75RUeOqGv097+c ybQZ5fysSf3zeAIxGSFlZcpruHpLylwRXumhiOjqWjKbEeN2r9MqcutIKUVt2lkP p2BsqKN7CzmSMWLO13DYr7cSufKqm6AOe0pTqJJKTI/yST7DpHkDsi+FYN7eZ79w xETITd0Z/7/dF1uwBIkAlQMFEDZ4S3QCetOcrPWlRQEBcwkEAJbhw4ggjcenRNNo 357I8dzEHrIWIAhonjAnWddEwyGFUy1cmayNTO/PRXjubCEFuJttWZ50cKPpiwYr oxGOglUnX52aw7lZMIrQOTwe25VyrXIsSGDa3a+pyWHiWcRuAIAIP68rfFEYLhYf MMqBkh6f9QvipntvSYpuciS5xF9biQEVAwUQNnhHnTuFIe3ySu75AQH4NAf9GSYF T+rrPJhKHKnRT0qbnfwhgCGy6nQyjC1fEPLfnZnwoAvW1GO7JaXa516RbFkrrvHN vUeatXkRM3m94MSRdTfxabdgHlySbIkzGtCN0LaUI+it304UdheqP9cHbeQReMhf SmX0iEEbW+uUsfjv3+C2DiuHVb/xbql+Kacd+jf03OpRYRZg/lM7+WVJPhIg869Z WTeGc7THYVshQ8I/Ea9+O/PhqdZamHyG2bdpZVN24v6y/ULHrTTWZ4fUeybHNQzL bdJ2gpE58V+nbdcL7qkAU8fiHrTQwTWqp5tT1YBWUmFQKk/ETxQb1YEHnEIaPiKx p4FT/BTu0xj5D+72/4kAlQMFEDZ4N0EEz4FNUUxSeQEB6gQD/RqBgIU/BiVNUe/7 iKOUxATGhetqm82FbOhSRuoeqZjL6NV+CfLzTzF17ngXPopQ4B7Nf0vKzEhkw6S4 OqJ6PMOg/PG0dEbtTWFQL4BhUipkrCB+VfXnD8BbKz3cmUFgzTHdj/Rut3GTNjlL 7gWZTFAiBtkNvSaeRl40S4+UG4ys =ejCq -----END PGP PUBLIC KEY BLOCK----- 
-
-
-
\ No newline at end of file diff --git a/tests/unit/businesslayer/BusinessLayerTest.php b/tests/unit/businesslayer/BusinessLayerTest.php deleted file mode 100644 index 898458adb..000000000 --- a/tests/unit/businesslayer/BusinessLayerTest.php +++ /dev/null @@ -1,97 +0,0 @@ - - * @author Bernhard Posselt - * @copyright Alessandro Cosentino 2012 - * @copyright Bernhard Posselt 2012, 2014 - */ - -namespace OCA\News\BusinessLayer; - -require_once(__DIR__ . "/../../classloader.php"); - - -use \OCP\AppFramework\Db\DoesNotExistException; -use \OCP\AppFramework\Db\MultipleObjectsReturnedException; - -use \OCA\News\Db\Folder; - - -class TestBusinessLayer extends BusinessLayer { - public function __construct($mapper){ - parent::__construct($mapper); - } -} - -class BusinessLayerTest extends \PHPUnit_Framework_TestCase { - - protected $mapper; - protected $newsBusinessLayer; - - protected function setUp(){ - $this->mapper = $this->getMockBuilder('\OCA\News\Db\ItemMapper') - ->disableOriginalConstructor() - ->getMock(); - $this->newsBusinessLayer = new TestBusinessLayer($this->mapper); - } - - - public function testDelete(){ - $id = 5; - $user = 'ken'; - $folder = new Folder(); - $folder->setId($id); - - $this->mapper->expects($this->once()) - ->method('delete') - ->with($this->equalTo($folder)); - $this->mapper->expects($this->once()) - ->method('find') - ->with($this->equalTo($id), $this->equalTo($user)) - ->will($this->returnValue($folder)); - - $this->newsBusinessLayer->delete($id, $user); - } - - - public function testFind(){ - $id = 3; - $user = 'ken'; - - $this->mapper->expects($this->once()) - ->method('find') - ->with($this->equalTo($id), $this->equalTo($user)); - - $this->newsBusinessLayer->find($id, $user); - } - - - public function testFindDoesNotExist(){ - $ex = new DoesNotExistException('hi'); - - $this->mapper->expects($this->once()) - ->method('find') - ->will($this->throwException($ex)); - - $this->setExpectedException('\OCA\News\BusinessLayer\BusinessLayerException'); - $this->newsBusinessLayer->find(1, ''); - } - - - public function testFindMultiple(){ - $ex = new MultipleObjectsReturnedException('hi'); - - $this->mapper->expects($this->once()) - ->method('find') - ->will($this->throwException($ex)); - - $this->setExpectedException('\OCA\News\BusinessLayer\BusinessLayerException'); - $this->newsBusinessLayer->find(1, ''); - } - -} diff --git a/tests/unit/businesslayer/FeedBusinessLayerTest.php b/tests/unit/businesslayer/FeedBusinessLayerTest.php deleted file mode 100644 index 786b3016c..000000000 --- a/tests/unit/businesslayer/FeedBusinessLayerTest.php +++ /dev/null @@ -1,723 +0,0 @@ - - * @author Bernhard Posselt - * @copyright Alessandro Cosentino 2012 - * @copyright Bernhard Posselt 2012, 2014 - */ - - -namespace OCA\News\BusinessLayer; - -require_once(__DIR__ . "/../../classloader.php"); - -use \OCP\AppFramework\Db\DoesNotExistException; - -use \OCA\News\Db\Feed; -use \OCA\News\Db\Item; -use \OCA\News\Fetcher\Fetcher; -use \OCA\News\Fetcher\FetcherException; - -class FeedBusinessLayerTest extends \PHPUnit_Framework_TestCase { - - private $feedMapper; - private $feedBusinessLayer; - private $user; - private $response; - private $fetcher; - private $itemMapper; - private $threshold; - private $time; - private $importParser; - private $autoPurgeMinimumInterval; - private $enhancer; - private $purifier; - private $l10n; - private $logger; - private $loggerParams; - - protected function setUp(){ - $this->logger = $this->getMockBuilder( - '\OCP\ILogger') - ->disableOriginalConstructor() - ->getMock(); - $this->loggerParams = ['hi']; - $this->time = 222; - $this->autoPurgeMinimumInterval = 10; - $timeFactory = $this->getMock('TimeFactory', ['getTime']); - $timeFactory->expects($this->any()) - ->method('getTime') - ->will($this->returnValue($this->time)); - $this->l10n = $this->getMockBuilder('\OCP\IL10N') - ->disableOriginalConstructor() - ->getMock(); - $this->feedMapper = $this->getMockBuilder('\OCA\News\Db\FeedMapper') - ->disableOriginalConstructor() - ->getMock(); - $this->fetcher = $this->getMockBuilder('\OCA\News\Fetcher\Fetcher') - ->disableOriginalConstructor() - ->getMock(); - $this->itemMapper = $this->getMockBuilder('\OCA\News\Db\ItemMapper') - ->disableOriginalConstructor() - ->getMock(); - $this->enhancer = $this->getMockBuilder('\OCA\News\ArticleEnhancer\Enhancer') - ->disableOriginalConstructor() - ->getMock(); - $this->purifier = $this->getMock('purifier', ['purify']); - $config = $this->getMockBuilder( - '\OCA\News\Utility\Config') - ->disableOriginalConstructor() - ->getMock(); - $config->expects($this->any()) - ->method('getAutoPurgeMinimumInterval') - ->will($this->returnValue($this->autoPurgeMinimumInterval)); - - $this->feedBusinessLayer = new FeedBusinessLayer($this->feedMapper, - $this->fetcher, $this->itemMapper, $this->logger, $this->l10n, - $timeFactory, $config, $this->enhancer, $this->purifier, $this->loggerParams); - $this->user = 'jack'; - } - - - public function testFindAll(){ - $this->feedMapper->expects($this->once()) - ->method('findAllFromUser') - ->with($this->equalTo($this->user)) - ->will($this->returnValue($this->response)); - - $result = $this->feedBusinessLayer->findAll($this->user); - $this->assertEquals($this->response, $result); - } - - - public function testCreateDoesNotFindFeed(){ - $ex = new FetcherException('hi'); - $url = 'test'; - $this->l10n->expects($this->once()) - ->method('t'); - $this->fetcher->expects($this->once()) - ->method('fetch') - ->with($this->equalTo($url)) - ->will($this->throwException($ex)); - $this->setExpectedException('\OCA\News\BusinessLayer\BusinessLayerException'); - $this->feedBusinessLayer->create($url, 1, $this->user); - } - - public function testCreate(){ - $url = 'http://test'; - $folderId = 10; - $createdFeed = new Feed(); - $ex = new DoesNotExistException('yo'); - $createdFeed->setUrl($url); - $createdFeed->setUrlHash('hsssi'); - $createdFeed->setLink($url); - $item1 = new Item(); - $item1->setGuidHash('hi'); - $item2 = new Item(); - $item2->setGuidHash('yo'); - $return = [ - $createdFeed, - [$item1, $item2] - ]; - - $this->feedMapper->expects($this->once()) - ->method('findByUrlHash') - ->with($this->equalTo($createdFeed->getUrlHash()), $this->equalTo($this->user)) - ->will($this->throwException($ex)); - $this->fetcher->expects($this->once()) - ->method('fetch') - ->with($this->equalTo($url)) - ->will($this->returnValue($return)); - $this->feedMapper->expects($this->once()) - ->method('insert') - ->with($this->equalTo($createdFeed)) - ->will($this->returnValue($createdFeed)); - $this->itemMapper->expects($this->at(0)) - ->method('findByGuidHash') - ->with( - $this->equalTo($item2->getGuidHash()), - $this->equalTo($item2->getFeedId()), - $this->equalTo($this->user)) - ->will($this->throwException($ex)); - $this->enhancer->expects($this->at(0)) - ->method('enhance') - ->with($this->equalTo($return[1][1]), - $this->equalTo($url)) - ->will($this->returnValue($return[1][1])); - $this->purifier->expects($this->at(0)) - ->method('purify') - ->with($this->equalTo($return[1][1]->getBody())) - ->will($this->returnValue($return[1][1]->getBody())); - $this->itemMapper->expects($this->at(1)) - ->method('insert') - ->with($this->equalTo($return[1][1])); - $this->itemMapper->expects($this->at(2)) - ->method('findByGuidHash') - ->with( - $this->equalTo($item1->getGuidHash()), - $this->equalTo($item1->getFeedId()), - $this->equalTo($this->user)) - ->will($this->throwException($ex)); - $this->enhancer->expects($this->at(1)) - ->method('enhance') - ->with($this->equalTo($return[1][0]), - $this->equalTo($url)) - ->will($this->returnValue($return[1][0])); - $this->purifier->expects($this->at(1)) - ->method('purify') - ->with($this->equalTo($return[1][0]->getBody())) - ->will($this->returnValue($return[1][0]->getBody())); - $this->itemMapper->expects($this->at(3)) - ->method('insert') - ->with($this->equalTo($return[1][0])); - - $feed = $this->feedBusinessLayer->create($url, $folderId, $this->user); - - $this->assertEquals($feed->getFolderId(), $folderId); - $this->assertEquals($feed->getUrl(), $url); - $this->assertEquals($feed->getArticlesPerUpdate(), 2); - } - - - public function testCreateItemGuidExistsAlready(){ - $url = 'http://test'; - $folderId = 10; - $ex = new DoesNotExistException('yo'); - $createdFeed = new Feed(); - $createdFeed->setUrl($url); - $createdFeed->setUrlHash($url); - $createdFeed->setLink($url); - $item1 = new Item(); - $item1->setGuidHash('hi'); - $item2 = new Item(); - $item2->setGuidHash('yo'); - $return = [ - $createdFeed, - [$item1, $item2] - ]; - - $this->feedMapper->expects($this->once()) - ->method('findByUrlHash') - ->with($this->equalTo($createdFeed->getUrlHash()), - $this->equalTo($this->user)) - ->will($this->throwException($ex)); - $this->fetcher->expects($this->once()) - ->method('fetch') - ->with($this->equalTo($url)) - ->will($this->returnValue($return)); - $this->feedMapper->expects($this->once()) - ->method('insert') - ->with($this->equalTo($createdFeed)) - ->will($this->returnValue($createdFeed)); - $this->itemMapper->expects($this->at(0)) - ->method('findBy