@@ 18-43 (lines=26) @@ | ||
15 | * @param string $repositoryName |
|
16 | * @param string $entityName |
|
17 | */ |
|
18 | public function executePublish($siteId, $commandName, $repositoryName, $entityName) |
|
19 | { |
|
20 | $command = $this->application->find($commandName); |
|
21 | $commandTester = new CommandTester($command); |
|
22 | ||
23 | $site = static::$kernel->getContainer()->get('open_orchestra_model.repository.site')->findOneBySiteId($siteId); |
|
24 | $fromStatus = static::$kernel->getContainer()->get('open_orchestra_model.repository.status') |
|
25 | ->findByAutoPublishFrom(); |
|
26 | $elements = static::$kernel->getContainer()->get($repositoryName) |
|
27 | ->findElementToAutoPublish($site->getSiteId(), $fromStatus); |
|
28 | ||
29 | $commandTester->execute(array('command' => $command->getName())); |
|
30 | $this->assertRegExp( |
|
31 | '/Publishing '.$entityName.'s for siteId ' . $siteId . '/', |
|
32 | $commandTester->getDisplay() |
|
33 | ); |
|
34 | ||
35 | foreach ($elements as $element) { |
|
36 | $this->assertRegExp( |
|
37 | '/-> ' . $element->getName() . ' \(v' . $element->getVersion() . ' ' . $element->getLanguage() . '\) published/', |
|
38 | $commandTester->getDisplay() |
|
39 | ); |
|
40 | } |
|
41 | ||
42 | $this->assertRegExp('/Done./', $commandTester->getDisplay()); |
|
43 | } |
|
44 | /** |
|
45 | * @param string $siteId |
|
46 | * @param string $commandName |
|
@@ 50-75 (lines=26) @@ | ||
47 | * @param string $repositoryName |
|
48 | * @param string $entityName |
|
49 | */ |
|
50 | public function executeUnpublish($siteId, $commandName, $repositoryName, $entityName) |
|
51 | { |
|
52 | $command = $this->application->find($commandName); |
|
53 | $commandTester = new CommandTester($command); |
|
54 | ||
55 | $site = static::$kernel->getContainer()->get('open_orchestra_model.repository.site')->findOneBySiteId($siteId); |
|
56 | $fromStatus = static::$kernel->getContainer()->get('open_orchestra_model.repository.status') |
|
57 | ->findOneByPublished(); |
|
58 | $elements = static::$kernel->getContainer()->get($repositoryName) |
|
59 | ->findElementToAutoUnpublish($site->getSiteId(), $fromStatus); |
|
60 | ||
61 | $commandTester->execute(array('command' => $command->getName())); |
|
62 | $this->assertRegExp( |
|
63 | '/Unpublishing '.$entityName.'s for siteId ' . $siteId . '/', |
|
64 | $commandTester->getDisplay() |
|
65 | ); |
|
66 | ||
67 | foreach ($elements as $element) { |
|
68 | $this->assertRegExp( |
|
69 | '/-> ' . $element->getName() . ' \(v' . $element->getVersion() . ' ' . $element->getLanguage() . '\) unpublished/', |
|
70 | $commandTester->getDisplay() |
|
71 | ); |
|
72 | } |
|
73 | ||
74 | $this->assertRegExp('/Done./', $commandTester->getDisplay()); |
|
75 | } |
|
76 | } |
|
77 |